Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: No module named contextlib?

Tags:

python

Does anyone know where i can find this python module 'contextlib'?

root@overo:~# python                                                            
Python 2.6.6 (r266:84292, Mar  9 2011, 10:05:36)                                
[GCC 4.3.3] on linux2                                                           
Type "help", "copyright", "credits" or "license" for more information.          
>>> import contextlib                                                           
Traceback (most recent call last):                                              
  File "<stdin>", line 1, in <module>                                           
ImportError: No module named contextlib                                         

I did not compile python myself personally. I'm just in this mess. It's running on an ARM based CPU so maybe some things were left out to save space.

I ran find / | grep contextlib which resulted in nothing.

Can i download this module from somewhere and just plonk it in /usr/lib/python2.6? Will that work?

like image 395
JavaRocky Avatar asked Apr 02 '11 01:04

JavaRocky


2 Answers

With Angsrom Linux, contextlib is included in the python-misc package. You can grab it by running:

opkg install python-misc

This won't, however, get you all expected python modules, so you may also want to install python-modules:

opkg install python-modules
like image 103
tsellon Avatar answered Oct 01 '22 10:10

tsellon


I got this error in a different way.

I created a pipenv virtual environment using the 32bit version of Python 3.6.5 on Windows 10. I then realized I needed the 64bit version. Uninstalled the 32bit, installed the 64bit, and then tried to go back to my existing virtual env. The previously created env was now broken in odd ways and gave me this error.

I solved this by removing the old pipenv pipenv --rm and creating a new one with the newly installed version of python.

like image 40
Ian Danforth Avatar answered Oct 01 '22 09:10

Ian Danforth