Best practice for updating Python modules?

Good morning,

I have been learning Python for two or three months, but now I find some problems with my 2.7 installation as I studied modules like nltk.

However, when I want to list the modules using the help ("modules"), I have a basic error, which seems to me to explain the problem:

/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 get the following error related to obsolete 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 am still trying to handle the paths and wondering if anyone can help me avoid this problem in the future. Thanks.

+7
source share
1 answer

You have installed packages in your Python library of the operating system. This is a big no. What you have to do is create an isolated, one-time Python environment using the virtualenv tool:

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

Thus, when updating packages or having to get rid of them, you can always reset the state of all your Python packages by simply deleting the environment and creating a new one.

Python packages installed using pip or easy_install commands are easy to install, but cannot be removed ...

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

+6
source

All Articles