Question

Good morning,

I've been learning Python for two or three months now but now finding some problems with my 2.7 installation as I've looked into modules such as nltk.

However, when I want to list modules using help ("modules) I have the main error which I think explains the problem is:

    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/setuptools/command/install_scripts.py:3: UserWarning: Module numpy was already imported from /Library/Python/2.7/site-packages/numpy-override/numpy/__init__.pyc, but /Library/Python/2.7/site-packages/numpy-1.8.0.dev_5c944b9_20120828-py2.7-macosx-10.8-x86_64.egg is being added to sys.path
from pkg_resources import Distribution, PathMetadata, ensure_directory

I also receive the following error to do with deprecated modules:

    /Library/Python/2.7/site-packages/statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg/scikits/statsmodels/__init__.py:2: UserWarning: scikits.statsmodels namespace is deprecated and will be removed in 0.5, please use statsmodels instead

I'm still trying to get to grips with paths and wonder if anyone can help me avoid this issue in future. Thank you.

Was it helpful?

Solution

You have installed packages under your operating system Python library. This is big no no. What you should have done is to create an isolated, disposable, Python environment with virtualenv tool:

http://opensourcehacker.com/2012/09/16/recommended-way-for-sudo-free-installation-of-python-software-with-virtualenv/

This way, when you upgrade your packages or need to get rid of them you can always reset the state of all of your Python packages by simply deleting the environment and creating new one.

Python packages installed via pip or easy_install commands are easy to install, but impossible to uninstall...

But when the damage has already happened you nede to manually try to clean up /Library/Python/2.7/site-packages/ by deleting files by and trying not to destroy your system Python in the process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top