When I use pip install camelcase, it successfully installs the package and when I run pip freeze I am able to see this package installed on the terminal.
from camelcase import CamelCase
It produces an error where No module named camelcase when I use it on my file. Same error for other packages such as requests etc
However, it works perfectly fine when I do
python3 -m pip install camelcase
I have the following to my environmental user variable path for Windows
C:\Python38
C:\Python38\Scripts
Python version I am using is Python 3.8.2 and the pip version is 20.3.3
Kindly advise. Thank you
Related
I've been seeing the error No module named 'ruamel' when running a python script (with python3), even after running the command pip3 install ruamel.yaml
The issue was that the versions of pip and python were mismatched, so pip was installing the ruamel module onto python 3.8, but running python3 was using python 3.9
To diagnose the issue:
Check the python version being used with python3 --version
Check the pip version being used with pip3 --version
If the versions are different, you can call pip with the exact version number. For example, pip3.9 install ruamel.yaml to ensure that the module is installed onto the correct python version.
I wanted to make a voice assistant importing SpeechRecognition on Python;
I installed PyAudio and SpeechRecognition with the following commands: pip install PyAudio pip install SpeechRecognition on Linux, but when I try to import SpeechRecognition with import speech_recognition as sr, VSCodium doesn't import the module.
But then I tried to import other modules, and the same thing happens... what should I do?
You can check which pip you are using through pip --version, and which python you are using through where python(cmd) or get-command python(PowerShell). Make sure pip matches up with the python interpreter you are using.
If it's not, you can try to reopen the terminal with the shortcut 'Ctrl+Shift+`'. And then to check the pip version again.
If it still not matches up with the interpreter. That's maybe this environment hasn't installed the pip in this environment.
I think its main reason is on Linux pip is for python 2 while pip3 is for python 3.
If you are using py3 using pip3 may help. Other reasons may include a virtual environment you are on.If vscodium does not automatically activate it or whatever extension you are using do not run in the virtual environment it may not find the packages you installed. you can try these commands:
Example:
pip3 install PyAudio
pip3 install SpeechRecognition
python3 main.py
I am unable to install a module called 'jieba' in Python 3 which is running in Jupyter Notebook 6.0.0. I keep getting ModuleNotFoundError: No module named 'jieba' after trying these methods:
1. import jieba
2. pip3 install jieba
Can anyone help? Thank you.
pip3 in the terminal is almost certainly installing your package into a different Python installation.
Rather than have you hunt around for the right installation, you can use Python and Jupyter themselves to ensure you are using the correct Python binary. This relies on three tricks:
You can execute the pip command-line tool as a module by running python -m pip .... This uses the pip module installed for the python command, so you don't have to verify what python installation the pip3 command is tied to.
You can get the path of the current Python interpreter with the sys.executable attribute.
You can execute shell commands from Jupyter notebooks by prefixing the shell command with !, and you can insert values generated with Python code with {expression}
You can combine these to run pip (to install packages or run other commands) against the current Python installation, from Jupyter itself, by adding this into a cell:
import sys
!{sys.executable} -m pip <pip command line options>
To install your jieba package, that makes:
import sys
!{sys.executable} -m pip install jieba
If you are using Anaconda, then you could also install the conda package for jieba; the package does not require any platform-specific dependencies or compilation, but it may be more convenient for you or necessary to install other packages that do have such requirements and have pre-compiled conda packages.
In that case, tell the conda command about your Python executable:
import sys
!conda install --yes --prefix {sys.prefix} <package name>
I'm running Python 3.5 (on Windows) and I have installed python-ldap from https://pypi.python.org/pypi/python-ldap/
I also tried using ldap3 but I keep getting an error saying
"ImportError: No module named 'ldap'
I looked around and saw some people saying there's no python-ldap for 3.5 so I installed 2.6 still getting the same error.
Is there a way to import ldap and make it work for Python 3.5?
Try the command below:
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo pip3 install pyldap
Open a command line(cmd, powershell, git bash)
Check you python version
$ pyhton --version
Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/
Download the library according with your python version and windows system
And install it on a command line using
pip install file_downloaded.whl
For example:
If you have python 3.5x and windows x64,
download the file python_ldap‑3.2.0‑cp35‑cp35m‑win_amd64.whl
pip install python_ldap‑3.2.0‑cp35‑cp35m‑win_amd64.whl
I'm running Apache Airflow on an Amazon EC2-Instance and I was getting "ImportError: No module named 'ldap3'. I used these two sites https://www.python-ldap.org/en/latest/installing.html and http://ldap3.readthedocs.io/installation.html to run the commands sudo python -m pip install python-ldap and sudo pip install ldap3 but my pip wasn't working for the last command so after some investigation I found out in my /usr/bin/ directory I had pip, pip-2.7, pip-3.6, and pip-python so I changed the command to pip-3.6 install ldap3 and then everything worked! Hope this helps someone.
I tried multiple approaches but finally, PyPI official documentation fixed this.
I was trying to execute on VS Code and did pip3 install python-ldap, but it didn't solve the issue. So I did the below from VS Code
# %% - This runs the below code as a Jupyter notebook cell
!pip3 install python-ldap
Now, I am able to import ldap and use it
Inside you folder, you can use virtualenv for python 3, example:
/opt/python-ldap-test
virtualenv -p /usr/bin/python3.5 venv
source venv/bin/activate
and then
pip install ldap3
It's extremely complicated to make things from 2.X to work in 3.X. Have you tried using it in a separate, 2.X only script and using it from there? It's not so unusual to combine python 2.X with 3.X in that manner or so I've heard.
I am very new to the world of coding, so I will try to provide as much information as i can regarding to my question.
Essentially, I wanted to install a module (moviepy) for Python 3. The site were I found the module suggested I use pip to unpack and install the module, so I did.
In my terminal, I entered pip install moviepy and pip proceeded to unpack and install my module, yay!
I then went over to my IDLE to see if the module would import, import moviepy, but received this error:
ImportError: No module named 'moviepy'
Huh? I thought I had just installed moviepy?
Upon further investigation, the module appears to have been written to my Python 2.7 site-packages folder and not my in Python 3 site-packages folder.
So my question is: How can I get my module to install to Python 3?
The modules website says that it is compatible with Python 3.
Im assuming this is a file path issue of some kind, but i don't know where to begin.
I'm currently using a OS X Yosemite version 10.10.2, Python 2.7.6, Python 3.5.0
Any help or comments are greatly appreciated here!
Help the n00b!
If you are using python in linux you must run pip with python3:
python3 -m pip install moviepy
according to python official doc :
On Linux, Mac OS X and other POSIX systems, use the versioned Python
commands in combination with the -m switch to run the appropriate copy
of pip:
python2 -m pip install SomePackage # default Python 2
python2.7 -m pip install SomePackage # specifically Python 2.7
python3 -m pip install SomePackage # default Python 3
python3.4 -m pip install SomePackage # specifically Python 3.4
Since pip itself is written in python , you could simply run the following in your terminal:
/path/to/python3 /usr/bin/pip install foo
More info:
To install pip, securely download get-pip.py
Run the following (which may require administrator access):
/path/to/python3 get-pip.py
Try below version of moviepy
pip install moviepy==0.2.3.5