I am using this weird SuSE machine. I need to install a python package in my python 2.7. I downloaded it from the site and then untar it and cd to the directory.. Tried:

cd /python-package_Pyxnat/
python2.7 setup.py install

I am getting following output:

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'summary'
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/site-packages/pyxnat-
Writing /usr/local/lib/python2.7/site-packages/pyxnat-

Error after importing pyxnat package:

>>> import pyxnat
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyxnat/__init__.py", line 13, in <module>
    from .core import Interface
  File "pyxnat/core/__init__.py", line 4, in <module>
    from .interfaces import Interface
  File "pyxnat/core/interfaces.py", line 8, in <module>
    import requests
ImportError: No module named requests

Why am I not able to import python package even after installing it?

  • Use a package manager. It used to be zypper for SUSE. Maybe it's now something else. – Faheem Mitha Jan 11 '16 at 15:45

You installed the package, but not its dependencies. That is something running python setup.py install will not do for you, you better try a package manager like pip in which case you don't have download pyxnat first:

pip install pyxnat

which will get you all dependencies specified for pyxnat, not just the requests packages. Alternatively you can do:

pip install -e .

in the untarred pyxnat directory.

If you don't have pip installed use your package manager to install (probably called python-pip) or use the instructions here.

I second @Digisec recommendation of using a virtualenv, especially if your python version is used by some system programs as well.

  • I totally forgot about dependencies. Removing my answer. – Digisec Jan 11 '16 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.