Results 1 to 4 of 4

Thread: Package installation fails with pip for Python3

  1. #1

    Default Package installation fails with pip for Python3

    Hello,

    I want to install some additional packages for Python3 (e.g., NumPy, xmltodict, argparse, etc) on opensuse 13.2

    I run

    Code:
    pip3 install numpy
    This ends up with an error

    Code:
        
    "Cannot compile 'Python.h'. Perhaps you need to "
    
    SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
    Indeed, the devel package for Python3 is not installed. I attempt to change this:

    Code:
    >zypper in python3-devel
    The following NEW package is going to be installed:
      python3-devel 
    
    
    The following 2 packages are going to be upgraded:
      python3 python3-base 
    
    
    2 packages to upgrade, 1 new.
    
    Overall download size: 6.6 MiB. Already cached: 0 B  After the operation, additional 1.1 MiB will be used.
    Continue? [y/n/? shows all options] (y): y
    
    (1/3) Installing: python3-base-3.4.5-4.4.1 .............................................................................................................................................[done]
    (2/3) Installing: python3-devel-3.4.5-4.4.1 ............................................................................................................................................[done]
    (3/3) Installing: python3-3.4.5-4.4.1 ..................................................................................................................................................[done]
    Done!

    Finally, I restart the installation with pip3:

    Code:
    >pip3 install numpy
    
    Traceback (most recent call last):
      File "/usr/bin/pip3", line 9, in <module>
        load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
      File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 356, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 2431, in load_entry_point
        return ep.load()
      File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 2147, in load
        ['__name__'])
      File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 9, in <module>
        from pip.log import logger
      File "/usr/lib/python3.4/site-packages/pip/log.py", line 8, in <module>
        from pip import backwardcompat
      File "/usr/lib/python3.4/site-packages/pip/backwardcompat/__init__.py", line 39, in <module>
        import xmlrpc.client as xmlrpclib
      File "/usr/lib64/python3.4/xmlrpc/client.py", line 137, in <module>
        from xml.parsers import expat
      File "/usr/lib64/python3.4/xml/parsers/expat.py", line 4, in <module>
        from pyexpat import *
    ImportError: /usr/lib64/python3.4/lib-dynload/pyexpat.cpython-34m.so: undefined symbol: _PyTraceback_Add
    I have reproduced this error on three different machines - two PCs running opensuse 13.2 and one laptop running opensuse 12.x.

    Reinstalling python3 with yast does not help. Compiling packages from sources without pip does not help either - I still get some "expat"-related error

    Please suggest a workaround.

    Thank you for your time.

  2. #2
    Join Date
    Nov 2016
    Location
    Prague, CZ
    Posts
    39

    Default Re: Package installation fails with pip for Python3

    Please try this and share the output if it's still not working:

    Code:
    sudo pip install --force numpy
    I was able to get it to work on my 13.2 test box with this command.
    Do what you can, with with you have, where you are.
    --Theodore Rooselvelt

  3. #3

    Default Re: Package installation fails with pip for Python3

    Thank for the hint, but its not working.

    The error output looks identical to what was before.

    Code:
    >pip install --force numpy
    
    Traceback (most recent call last):
      File "/usr/bin/pip", line 9, in <module>
        load_entry_point('pip==1.5.6', 'console_scripts', 'pip3.4')()
      File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 356, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 2431, in load_entry_point
        return ep.load()
      File "/usr/lib/python3.4/site-packages/pkg_resources.py", line 2147, in load
        ['__name__'])
      File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 9, in <module>
        from pip.log import logger
      File "/usr/lib/python3.4/site-packages/pip/log.py", line 8, in <module>
        from pip import backwardcompat
      File "/usr/lib/python3.4/site-packages/pip/backwardcompat/__init__.py", line 39, in <module>
        import xmlrpc.client as xmlrpclib
      File "/usr/lib64/python3.4/xmlrpc/client.py", line 137, in <module>
        from xml.parsers import expat
      File "/usr/lib64/python3.4/xml/parsers/expat.py", line 4, in <module>
        from pyexpat import *
    ImportError: /usr/lib64/python3.4/lib-dynload/pyexpat.cpython-34m.so: undefined symbol: _PyTraceback_Add

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,403
    Blog Entries
    2

    Default Re: Package installation fails with pip for Python3

    The default development languages including Python that are available by default on openSUSE are highly tested packages for general use.

    If you are either building new apps or find that an app won't work with existing packages, then you have to install more current packages from the repository for that specific language.

    It looks like the current Python3 repo for 13.2 can be installed by running the following in an elevated console
    Code:
    zypper in http://download.opensuse.org/repositories/devel:/languages:/python3/openSUSE_13.2/ Python3_13.2
    After your repo is installed, I recommend a system update to bring everything in your openSUSE up to date including updated packages from your new repo
    Code:
    zypper up
    Now,
    I would expect that anything you've downloaded from the Python repos using pip should run without a problem...

    If you continue to have a problem, based on your errors I'd suspect a Python3 version issue.
    Post again, and whether you are interested in maintaining different versions of Python on your machine using virtualenv or not.

    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •