Can't update Python packages

The initial error (when running pip-review --local --interactive)

ERROR: Command errored out with exit status 2:
    command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-addm74do/ll
fuse/setup.py'"'"'; __file__='"'"'/tmp/pip-install-addm74do/llfuse/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"',
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exe
c'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-v4buqfo_                                                         
        cwd: /tmp/pip-install-addm74do/llfuse/                                                                      
   Complete output (4 lines):                                                                                       
   Package fuse was not found in the pkg-config search path.                                                        
   Perhaps you should add the directory containing `fuse.pc'                                                        
   to the PKG_CONFIG_PATH environment variable                                                                      
   Package 'fuse', required by 'virtual:world', not found                                                           
   ----------------------------------------                                                                         
ERROR: Command errored out with exit status 2: python setup.py egg_info Check the logs for full command output.

I then installed fuse-devel (fuse was already installed), the current lengthy error:

ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-exfob8tr/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo                                                                                
       cwd: None                                                                                                    
  Complete output (42 lines):                                                                                       
  Collecting setuptools                                                                                             
    Using cached setuptools-56.0.0-py3-none-any.whl (784 kB)                                                        
  Collecting wheel                                                                                                  
    Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)                                                          
  Collecting pycairo                                                                                                
    Using cached pycairo-1.20.0.tar.gz (344 kB)                                                                     
    Installing build dependencies: started                                                                          
    Installing build dependencies: finished with status 'done'                                                      
    Getting requirements to build wheel: started                                                                    
    Getting requirements to build wheel: finished with status 'done'                                                
      Preparing wheel metadata: started                                                                             
      Preparing wheel metadata: finished with status 'done'                                                         
  Building wheels for collected packages: pycairo                                                                   
    Building wheel for pycairo (PEP 517): started                                                                   
    Building wheel for pycairo (PEP 517): finished with status 'error'                                              
    ERROR: Command errored out with exit status 1:                                                                  
     command: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpkf7n8x50
         cwd: /tmp/pip-install-qcptdd9c/pycairo
    Complete output (19 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.9/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.9/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.9/cairo
    running build_ext
    building 'cairo._cairo' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/cairo
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=20 -DPYCAIRO_VERSION_MICRO=0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libxml2 -I/usr/include/python3.9 -c cairo/bufferproxy.c -o build/temp.linux-x86_64-3.9/cairo/bufferproxy.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
    cairo/bufferproxy.c:32:10: fatal error: Python.h: No such file or directory
       32 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
  Failed to build pycairo
  ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-exfob8tr/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.

You don’t have the python developer libraries installed:

sudo dnf install python3-devel

What are these python packages by the way? Are these in a virtual environment? Otherwise they’re going to always conflict with system installed python packages (stuff you’ve installed with dnf install).

PS: Can you also please edit your post to note what version of Fedora you are using etc.?

2 Likes

Now fails with pyparted-3.11.7, but no need to troubleshoot anymore.

I’ve installed packages from pypi somewhat blindly when I started with Linux. Some dependencies come from the reverse-engineered keyboard-/mouse-configuration software which I had to compile from source, but virtual:world I’ve for instance forgotten to which package it is or has been tied.

No virtual environment.

I’ve indeed forgotten to even search if a package is available in the Fedora repos.

>>> help('modules')

Please wait a moment while I gather a list of all available modules...

Crypto              beaker              ipaddress           resource
OpenSSL             binascii            iso8601             rlcompleter
PIL                 binhex              itertools           rpm
PyQt5               bisect              jinja2              runpy
SSSDConfig          blivet              json                savepagenow
Xlib                blivetgui           keyword             scanext
__future__          borg                langtable           sched
_abc                brlapi              lib2to3             scour
_aix_support        bs4                 libcomps            secrets
_ast                builtins            libdiscid           select
_asyncio            bytesize            libdnf              selectors
_audit              bz2                 libfuturize         selinux
_bisect             cProfile            libpasteurize       semanage
_blake2             cached_property     libxml2             semver
_bootlocale         cairo               libxml2mod          seobject
_bootsubprocess     calendar            linecache           sepolgen
_bz2                cerberus            llfuse              sepolicy
_cffi_backend       certifi             locale              setools
_codecs             cffi                logging             setuptools
_codecs_cn          cgi                 louis               sgmllib
_codecs_hk          cgitb               lxml                shellingham
_codecs_iso2022     chardet             lzma                shelve
_codecs_jp          chunk               mailbox             shlex
_codecs_kr          click               mailcap             shutil
_codecs_tw          clonevirtualenv     mako                signal
_collections        cmath               markdown            simpleline
_collections_abc    cmd                 markupsafe          site
_compat_pickle      code                marshal             six
_compression        codecs              math                slip
_contextvars        codeop              meh                 smtpd
_crypt              collections         mimetypes           smtplib
_csv                colorama            mmap                sndhdr
_ctypes             colorsys            modulefinder        socket
_curses             compileall          multidict           socketserver
_curses_panel       concurrent          multiprocessing     socks
_datetime           configargparse      mutagen             sockshandler
_dbm                configparser        natsort             sos
_dbus_bindings      contextlib          netrc               soupsieve
_dbus_glib_bindings contextvars         nftables            speechd
_decimal            copy                nis                 speechd_config
_elementtree        copyreg             nntplib             spwd
_functools          crypt               ntpath              sqlite3
_gdbm               cryptography        nturl2path          sre_compile
_hashlib            csv                 numbers             sre_constants
_heapq              ctypes              numpy               sre_parse
_imp                cups                officehelper        ssl
_io                 cupsext             olefile             stat
_json               cupshelpers         opcode              statistics
_locale             curl                operator            stevedore
_lsprof             curses              optparse            string
_lzma               dasbus              orca                stringprep
_markupbase         dataclasses         os                  struct
_md5                datetime            ossaudiodev         subliminal
_multibytecodec     dateutil            packaging           subprocess
_multiprocessing    dbm                 parse               sunau
_opcode             dbus                parser              symbol
_operator           decimal             parted              symtable
_osx_support        decorator           passwordgenerator   sys
_ped                difflib             past                sysconfig
_peg_parser         dis                 pathlib             syslog
_pickle             distlib             pbr                 systemd
_posixshmem         distro              pcardext            tabnanny
_posixsubprocess    distutils           pdb                 tarfile
_py_abc             dnf                 pexpect             telnetlib
_pydecimal          dnfpluginscore      picard              tempfile
_pyio               docopt              pickle              tempita
_queue              doctest             pickletools         termios
_random             dogpile             pid                 textwrap
_selinux            dotenv              pip                 this
_semanage           drv_libxml2         pip_review          threading
_sha1               easy_install        pipdeptree          time
_sha256             email               pipenv              timeit
_sha3               enchant             pipes               tkinter
_sha512             encodings           pipreqs             token
_signal             ensurepip           pkg_resources       tokenize
_sitebuiltins       enum                pkgutil             toml
_socket             enzyme              platform            tomlkit
_sqlite3            errno               plette              torbrowser_launcher
_sre                fasteners           plistlib            trace
_ssl                faulthandler        ply                 traceback
_stat               fcntl               poplib              tracemalloc
_statistics         feedparser          posix               trashcli
_string             filecmp             posixpath           tty
_strptime           fileinput           pprint              turtle
_struct             filelock            problem             turtledemo
_symtable           firewall            productmd           types
_sysconfigdata__linux_x86_64-linux-gnu first               profile             typing
_sysconfigdata_d_linux_x86_64-linux-gnu fnmatch             progressbar         typing_extensions
_thread             formatter           pstats              unbound
_threading_local    fractions           pty                 unboundmodule
_tkinter            ftplib              ptyprocess          unicodedata
_tracemalloc        functools           pwd                 unipath
_unbound            fuse                pwquality           unittest
_uuid               fuseparts           py_compile          uno
_warnings           future              pyanaconda          unohelper
_weakref            gc                  pyatspi             urllib
_weakrefset         genericpath         pyclbr              urllib3
_xxsubinterpreters  getopt              pycparser           uu
_zoneinfo           getpass             pycurl              uuid
abc                 gettext             pydoc               venv
abrt_exception_handler3 gi                  pydoc_data          virtualenv
abrtcli             glob                pyexpat             warnings
aifc                gnome_abrt          pyfros              wave
aiohttp             gpg                 pygtkcompat         weakref
antigravity         graphlib            pyinotify           webbrowser
appdirs             graphviz            pykickstart         whatapi
argcomplete         grp                 pyparsing           wsgiref
argparse            gtweak              pysrt               wx
array               guessit             python_utils        xdg
ast                 gzip                pytz                xdrlib
async_timeout       hashlib             pyudev              xml
asynchat            hawkey              queue               xmlrpc
asyncio             heapq               quopri              xxlimited
asyncore            hmac                random              xxsubtype
atexit              hpmudext            rarfile             yarg
attr                html                re                  yarl
audioop             http                readline            yledl
audit               humanize            rebulk              zipapp
augeas              idna                report              zipfile
auparse             imaplib             reportclient        zipimport
autokey             imghdr              reprlib             zlib
babel               imp                 requests            zoneinfo
babelfish           importlib           requests_download   
base64              inspect             requests_file       
bdb                 io                  requests_ftp

It seems that the site has locked the post from being edited.

Fedora 33, Python 3.9.2, Virtualbox with guest additions is installed.

I’d strongly recommend using virtual environments. Otherwise you’re going to mix (or worse: overwrite) lots of different Python modules and in most cases you’ll end up breaking dnf and other core tools that need the system provided python modules.

When installing using pip, unless binary wheels etc. are provided on PyPi, you’re basically building the module from source—so you need all the build time requirements. In the snippet you’ve showed above, you need the python header files, which is provided by the python3-devel package.

2 Likes

This is becoming evident. Is there any easy way to reverse the damage, for instance by replace manually installed (from pypi.org) packages with those shipped by Fedora?

Currently I can’t install a specific Python package (required by spleeter) in the virtual environment:

(python-virtual-environment) [user@localhost ~]$ python -m pip install tensorflow==2.3.0

ERROR: Could not find a version that satisfies the requirement tensorflow==2.3.0
ERROR: No matching distribution found for tensorflow==2.3.0

Fails with the --force-reinstall flag as well.

I can reinstall the OS, but perhaps not until I get my higher-end setup.

Thank you for the guidance so far.

1 Like

Did you use sudo when you installed packages with pip? If not, your Fedora shipped packages should be fine. It would’ve installed packages in your user’s home directory only.

This is an unrelated issue. You need to check what version of Python tensorflow version 2.3.0 supported:

tensorflow · PyPI shows it does not support 3.9. So you either need to use a version that does, or use Python 3.8:

# Install Python 3.8
sudo dnf install python38
# Set up a Python 3.8 virtual environment and work there
python3.8 -m venv /path/to/virtualenv
# Activate etc.
source /path/to/virtualenv/bin/activate

No worries. That’s what we’re here for. Feel free to open new topics for specific issues. :+1:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.