Similar to this question I am trying to install the blink1 library on raspbian.
But no matter what I try, I get:
>>>import blink1
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import blink1
ImportError: No module named blink1
I installed it via pip and it is in the correct path as far as I understand it:
pi#raspberrypi ~ $ ls /usr/local/lib/python2.7/dist-packages/
blink1 python_jenkins-0.4.8.dist-info
blink1-0.0.12.dist-info pyusb-1.0.0rc1.egg-info
blink1_tests setuptools
click setuptools-18.3.1.dist-info
click-5.1.dist-info six-1.9.0.dist-info
configobj-5.0.6.dist-info six.py
configobj.py six.pyc
configobj.pyc usb
easy_install.py validate.py
easy_install.pyc validate.pyc
jenkins _version.py
_markerlib _version.pyc
pbr webcolors-1.5.dist-info
pbr-1.7.0.dist-info webcolors.py
pip webcolors.pyc
pip-7.1.2.dist-info wheel
pkg_resources wheel-0.24.0.dist-info
I don't know what else I should try now...
Edit: it does not seem to work with pyhthon3 either:
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import blink1
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import blink1
ImportError: No module named blink1
$ sudo pip-3.2 install blink1
Requirement already satisfied (use --upgrade to upgrade): blink1 in /usr/local/lib/python3.2/dist-packages
Edit 2: the last issue might have something to do with the fact that on this installation, the sys.path does only contain the 2.7 libraries, not the v3 dist-packages...
The file __init__.py is missing from /usr/local/lib/python2.7/dist-packages/blink1/
If you run
touch /usr/local/lib/python2.7/dist-packages/blink1/__init__.py
it should start working.
Reference:
https://github.com/todbot/blink1/pull/224
Related
For some reason I'm getting this error when trying to import gevent inside my docker container:
# python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gevent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/gevent/__init__.py", line 51, in <module>
from gevent.hub import get_hub, iwait, wait
File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 31, in <module>
from gevent._util import _NONE
ImportError: cannot import name _NONE
>>>
Which is odd because _util.py exists, it's in the dist-packages/gevent directory. When I did a pip install on another system, it works fine.
Anyone have any ideas what might be going on?
Have you upgraded gevent package recently or maybe installed it over old version?
I ran pip install --ignore-installed gevent to update old version of this package in my virtualenv, and then this error starts to appear.
I fixed it with pip uninstall gevent (two times to completely remove it) followed by pip install gevent.
I think you import gevnet this module is not you see it.
you can print something in you _util.py module.
if nothing print, I guess "/usr/local/lib/python2.7/dist-packages/gevent/hub.py" import _util is not in /usr/local/lib/python2.7/dist-packages/gevnet, and you can try to print sys.path to find real import path and fix it.
In my Method:
uninstall gevent.
use a another system gevnet or virtualenv package,and copy to you real(I guess you have a env path like '/usr/local/lib64')
exec python -c 'import gevent' test is ok.
I have installed numpy, scipy, scikit learn and other required packages. Still when I try to import them in python, it shows no module found.
pip install -U numpy scipy scikit-learn
Requirement already up-to-date: numpy in /usr/lib/python2.7/dist-packages
Collecting scipy
Downloading scipy-0.17.1-cp27-cp27mu-manylinux1_x86_64.whl (39.5MB)
100% |████████████████████████████████| 39.5MB 32kB/s
Requirement already up-to-date: scikit-learn in /home/tecsadmin/.local/lib/python2.7/site-packages
Installing collected packages: scipy
Found existing installation: scipy 0.17.0
DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling scipy-0.17.0:
Exception:
Traceback (most recent call last):
File "/home/tecsadmin/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/tecsadmin/.local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/home/tecsadmin/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "/home/tecsadmin/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "/home/tecsadmin/.local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/home/tecsadmin/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/dist-packages/scipy-0.17.0.egg-info'
tecsadmin#BLITZ:~/.local/lib/python2.7/site-packages/sklearn/__check_build$ python
Python 2.7.5 (default, Jun 17 2016, 04:41:21)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>>
Update
admin#BLITZ:~$ sudo pip install -U numpy scipy scikit-learn
[sudo] password for tecsadmin:
The directory '/home/tecsadmin/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/tecsadmin/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: numpy in /usr/lib/python2.7/dist-packages
Collecting scipy
Downloading scipy-0.17.1-cp27-cp27mu-manylinux1_x86_64.whl (39.5MB)
100% |████████████████████████████████| 39.5MB 32kB/s
Requirement already up-to-date: scikit-learn in ./.local/lib/python2.7/site-packages
Installing collected packages: scipy
Found existing installation: scipy 0.17.0
DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling scipy-0.17.0:
Successfully uninstalled scipy-0.17.0
Successfully installed scipy-0.17.1
tecsadmin#BLITZ:~$ python
Python 2.7.5 (default, Jun 17 2016, 04:41:21)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
UPDATE 2
tecsadmin#BLITZ:~$ pip freeze | grep numpy
numpy==1.11.0
tecsadmin#BLITZ:~$ pip freeze | grep scipy
scipy==0.17.1
tecsadmin#BLITZ:~$ pip freeze | grep scikit-learn
scikit-learn==0.17.1
tecsadmin#BLITZ:~$ python
Python 2.7.5 (default, Jun 17 2016, 04:41:21)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
Not sure if related but you are having a permission denied error, try with
sudo pip install -U numpy scipy scikit-learn
To double check your installation run pip freeze
$ pip freeze | grep numpy
$ numpy==1.9.2
That way you really check if it has been succesfuly installed
Also I would suggest you to use python virtual environments https://virtualenv.pypa.io/en/stable/ so you dont have to play with sudo permissions
You haven't installed the libs you got error 13 permission denied. Reinstall them using the command:
sudo pip install numpy scipy scikit-learn
i am using python 2.7.11 on virtualenv in lubuntu 12.04.(dont own a good laptop its dell latitude d600)
Python 2.7.11 (default, Mar 4 2016, 04:38:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sqlite3
Traceback (most recent call last):
File "", line 1, in
File "/home/maharshi/.localpython/lib/python2.7/sqlite3/init.py", line 24, in
from dbapi2 import *
File "/home/maharshi/.localpython/lib/python2.7/sqlite3/dbapi2.py", line 28, in
from _sqlite3 import *
ImportError: No module named _sqlite3
i have installed pysqlite using pip and it says successfull.
(p2.7) maharshi#maharshi-Latitude-D600:~/code$ which python
/home/maharshi/virtualenvs/p2.7/bin/python
(p2.7) maharshi#maharshi-Latitude-D600:~/code$ which pip
/home/maharshi/virtualenvs/p2.7/bin/pip
(p2.7) maharshi#maharshi-Latitude-D600:~/code$ pip install pysqlite
Requirement already satisfied (use --upgrade to upgrade): pysqlite in /home/maharshi/virtualenvs/p2.7/lib/python2.7/site-packages
i also installed it manually at both locations i.e
~/virtualenvs/p2.7/
~/.localpython/ (from where i created the virtualenv)
i also installed "libsqlite3-dev(as suggested by one of the posts)" i.e
sudo apt-get install libsqlite3-dev
Thank you in advance.
Try doing the whole process again installing python in virtualenv...as i understand when you add the libraries needed for SqlLite it wont affect the virtualenv python so you have to re-do all the steps and it will compile with the required libraries....
I am trying to use pypy in a virtualenv for better performance in running my python program. I was able to install all the required modules, except for lxml
So far, I tried
pip install lxml
Also tried
pip install --upgrade lxml
It shows the following message at the end:
Successfully installed lxml-3.4.4
However, when I start pypy prompt and try to import lxml, I get the error:
(venv)➜ pypy pypy
Python 2.7.3 (2.2.1+dfsg-1ubuntu0.2, Dec 02 2014, 23:00:55)
[PyPy 2.2.1 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``denial is rarely a good debugging
technique''
>>>> import lxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lxml
>>>> from lxml import html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lxml
Update:
I am using ubuntu 14.04
Also, I have tried
sudo apt-get install pypy-dev
I had a similar problem. I got it working by running sudo apt-get install python-dev libxml2 libxml2-dev libxslt-dev and then pip install --upgrade lxml
I installed django using pip, however typing import django in the python console yields the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
When I run pip install django I get the following:
Requirement already satisfied (use --upgrade to upgrade): django in /usr/local/lib/python2.7/site-packages
Cleaning up...
However running which python in the terminal yields the following:
/usr/bin/python
I am wondering whether django does not import because a version I installed using homebrew conflicts with the mac pre-installed version.
I should mention that i am able to import django in the console when in the directory /usr/local/lib/python2.7/site-packages
Any help is appreciated.
You should import django, not Django, watch the case.
Demo:
$ pip install django
Requirement already satisfied (use --upgrade to upgrade): django in ...
Cleaning up...
$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Django
>>> import django
>>>
I couldn't fix the $PATH conflict between my OSX default version (2.7.10) and my pip installed one (3.8). Instead, I manually specify the entire path when calling django-admin:
Go to your project folder in console and type (check your version first).
your_proyect_folder$ python3 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/bin/django-admin.py startproject your_folder_name