So, this was my first time making a python package. I tried and tested and got it to work. This meaning that pip install . didn't complain and that
$sudo python3
>>>from LEDController import prettyLight
>>>prettyLight().light('whatsapp',100)
provided expected output and actions in my LED matrix.
Also pip list includes LEDControllerm but as soon as I start python3 anywhere but in the LEDController package directory, the module is not being found.
Running pip install /path/to/LEDController/ is still successfull, as is pip3 install /path/to/LEDController/.
Yet I get
$sudo python3
>>> import LEDController
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'LEDController'
>>> from LEDController import prettyLight
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'LEDController'
What am I missing?
As #sinoroc said, installing only using pip is not the safest option. Instead using python3 -m pip install /path/to/module fixed the issue perfectly.
I'll put his link here so future viewers can read up on why this is.
Related
I'm trying to use the nba_api module.
I always install my packages on my Mac using the 'pip3 install' command.
Today I installed successfully the nba_api module but I can't use it due to the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'nba_api'
Also, I installed it using the 'pip install' command but I have the same problem.
The interpreter I use is Python 3.9.7.
Any help will be welcomed.
On my raspberry pi 4 I tried to code some basic stuff (like printing messages) to test out the pymodbustcp. I got the code from the pymodbustcp wiki so that shouldn't give the problem.
For some reason, it doesn't want to find the module of pymodbustcp and it gives this message below when I run the code. I think it has to do with pip but I am not sure
/home/pi/Desktop/Laadpunt/venv/bin/python /home/pi/Desktop/Laadpunt/main.py
Traceback (most recent call last):
File "/home/pi/Desktop/Laadpunt/main.py", line 7, in <module>
from pyModbusTCP.client import ModbusClient
ModuleNotFoundError: No module named 'pyModbusTCP'
Process finished with exit code 1
I installed both "sudo pip2 install pyModbusTCP" as "sudo pip3 install pyModbusTCP" in my console and that says:
pi#raspberrypi:~ $ sudo pip install pyModbusTCP
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'
pi#raspberrypi:~ $
What could be the reason for the issue and how would I fix it?? If you need any info from commands tell me which ones.
sudo pip is not the way to go to install to your venv.
You should install to your venv specifically by doing
/home/pi/Desktop/Laadpunt/venv/bin/python -m pip install ...
I used 'sudo apt-get install rake'.
>>> import rake
but Fails with error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named rake
Why this happened?I'm missing something.
Ok, I got answer.
$ git clone https://github.com/zelandiya/RAKE-tutorial
$ cd RAKE-tutorial/
:~/RAKE-tutorial$ python
>>> import rake
I guess you want to use this https://github.com/aneesha/RAKE .
Install using
pip install python-rake
In code
import RAKE
Here is my problem:
After I managed to install anaconda (having python 3.4), I apparently managed to install pybrain too. But when i use 'import pybrain' from anaconda or from the terminal too I get this error:
>>> import pybrain
Traceback (most recent call last):
File "<ipython-input-2-0fb7233d2a8c>", line 1, in <module>
import pybrain
File "//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/pybrain/__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
Simply running sudo pip3 install git+https://github.com/pybrain/pybrain.git worked for me after having the same issue.
The version up on PyPi isn't Python 3 compatible.
Installing the latest commit directly using pip3 should take care of your old package (from PyPi) as well.
I am trying to use pip on my Redhat system.
I installed pip following the instructions here, but when I try to use it, for example pip install, I get the following error code:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
this issue due to common user do not have privilege to access packages py file.
1. root user can run 'pip list'
2. other common user cannot run 'pip list'
[~]$ pip list
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal import main
ImportError: No module named pip._internal
solution :
root user login and run
chmod -R 755 /usr/lib/python2.7
fix this issue.
If pip is already installed and your unable to access it, one of the reason could be that you don't have permissions to read or execute the library. Try doing
sudo chmod -R u+rx /usr/lib/python2.7/site-packages/pip/
If pip is installed in a different folder, you can obtain the folder path by doing
>>> import pip
>>> pip.__path__
['/usr/lib/python2.7/site-packages/pip']
If you don't have root rights and running on python 2.6 then you can try this file https://bootstrap.pypa.io/2.6/get-pip.py (it is from same instruction you used, it is a simple python script which installs all dependencies and pip itself) and run it with command python get-pip.py --user