0

I have installed the modules (for example: configobj, matplotlib, etc.) but when I try to import these modules in my Python script and try to run those scripts using Linux/Ubuntu 14 command prompt, it is giving "ImportError: No module named configobj". But if I try to import the same module using ipython, it is not giving any issue. Python version: 2.7.6 (when I checked with sys.version in ipython)

I have already installed anaconda. I don't know whether it can trigger any issues.

Tried: Python error "ImportError: No module named"

I have tried changing $PYTHONPATH to point to anaconda lib/ directory as it was suggested in some post on stackoverflow only. Also, checked many questions here but unable to find any solution.

Followed some other links as well.

Thanks :)

Community
  • 1
  • 1
  • When you run 'pip freeze' do you have your modules in the list? – Oleksandr Dashkov Oct 31 '16 at 13:06
  • File "/usr/bin/pip", line 5, in from pkg_resources import load_entry_point ImportError: No module named pkg_resources – Udbhav Kalra Oct 31 '16 at 13:12
  • Could you try this procedure http://stackoverflow.com/questions/7446187/no-module-named-pkg-resources and reinstall your package after – Oleksandr Dashkov Oct 31 '16 at 13:15
  • I don't have that much knowledge with Python packages. This link thing is not working for me . Instead I tried reinstalling it using :sudo apt-get install --reinstall python-pkg-resources but now, I am not even able to use ipython (maybe because of some interconnection with pkg_tools) – Udbhav Kalra Oct 31 '16 at 13:33
  • It's helpful if you described how you installed Python, and IPython on this setup. The fact that module loads in IPython but the Python script can not load it, shows that the module is installed somewhere, that is not available in your Python interpreter PYTHONPATH. – farzad Oct 31 '16 at 13:56

1 Answers1

0

Your new module needs to be in a path like

C:\Users\**SOMEUSER**\AppData\Local\Continuum\Anaconda2\Lib\site-packages

then you should install the module from cmd with

python setup.py install

(dont forget to cd to the modules directory in cmd..)

as there should be a "setup.py"-file in the modules directory.

You do not need your env-variable to look into Anaconda2\lib, who did you tell this?!

PYTHONPATH is for your python.exe to call python from cmd...