I am having error importing modules in my jupyter notebook when running it on a mac machine after successfully installing them using:
!pip install <library name>.
I try it on several modules and error persists.
for example, when running this code
!pip install pyenchant
I get this:
Requirement already satisfied: pyenchant in
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(3.2.2)
when running :
import enchant
I am getting an error message:
ModuleNotFoundError: No module named 'pyspellchecker'
then try to run this (as I read this could help)
!python -m pip install -U pyenchant
and get that:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pip
I think it has something to do with python path and bash_profile but I do not have an intuition for it.
I do not know if it is helpful/relevant, but I have Pycharm, python, Visual Studio Code and anconda installed on my machine. I am doubting that the problem comes from misalignment between the common configuration files of these programs.
can you please help?
I realize that many has encounter similar issue but their solutions did not help me.
p.s. the issue disappear when I use conda install , but I would like to use pip as it give me access to larger library options.
Related
I seem to be facing this error continuously despite:
Installing the mysql-connector via "python -m pip install mysql-connector-python"
Installing the MySQL package via "pip install MySQL"
I have confirmed that I have installed the package as it says "Requirement already satisfied everytime I run it again in the terminal". Additionally, I have tried installing and reinstalling the package as well.
But all the results are the same. Each time I run my script and try to "import mysql.connector", I always get the ModuleNotFoundError: No module named 'mysql' error
Would greatly appreciate some help. Thank you very much
Do you use virtual environments? If it is a virtual environment, please copy the contents in the expansion package folder of the virtual environment to the package folder under python.
If you have two versions of Python in your system, you may also encounter this problem. "CTRL+SHIFT+P" and choose the correct interpreter.
You can use the following method to check and see where pip installed the package:
pip show MySQL
I tried installing 'pandas' and 'xlrd' using pip install but I get this error from python when I try and use the modules: ImportError: No module named xlrd. Same error when I use pandas. I have tried various methods from the internet to solve this issue including:
changing package permissions
using sudo pip install
adding PYTHONPATH export in the bash_profile file.
using pip3 because I have python 3
I even tried this approach https://stackoverflow.com/a/49602260, but in my case I already had the package location(which I got using pip show xlrd) inside the sys.path list.
None of the above approaches have worked for me.
Edit: I use VSCode as my IDE and I run my files through the inbuilt terminal.
I had used a pip install to install the pyeeg library, the code to which is as follows(installing the package in the jupyter notebook environment using ! before the pip install statement):
pip install pyeeg
The package and its other associated dependencies get installed, but when trying to import the library, the code to which is as follows:
import pyeeg
The following error is displayed:
ModuleNotFoundError: No module named 'pyeeg'
I've tried installing the library in user mode too, but the same error gets displayed
I've also tried downloading the respective source code file and placing it in my directory path, but the file seems to be having an issue.
Looking for some help in this regard.
Thank you,
Installation can be done as specified in the main repo. The steps are as follows:
git clone https://github.com/forrestbao/pyeeg.git
cd pyeeg
python setup.py install
python setup.py install --user
I have been stuck on a module not found error of python3.
I have a VM on Microsoft Azure, a Centos 7. Then I installed python3 and pip3, and some packages I needed. But there’s one package that I just couldn’t find after I installed it
sudo pip3 install --user stockstats
But whenever i wanted to run a python script using this package, there’s
ModuleNotFoundError: No module named 'stockstats'
What I tried:
pip3 show stockstats
As I really want to see where it was installed. It shows nothing. What it is supposed to do is like this:
Name: openpyxl
Version: 3.0.7
Summary: A Python library to read/write Excel 2010 xlsx/xlsm files
Home-page: https://openpyxl.readthedocs.io
Author: See AUTHORS
Author-email: charlie.clark#clark-consulting.eu
License: MIT
Location: /usr/local/lib/python3.6/site-packages
…
Then I guess it might be something wrong with the installed path, so I uninstalled the package, and then did
sudo pip3 install stockstats --install-option="--prefix=/usr/local/lib"
(I am just guessing if openpyxl is installed there then stockstats should be there too, as python imported openpyxl successfully)
That didn’t work as well, the error still persists.
*I didn’t use any package manager other than pip3.
** some irregularities occurred when I was trying to use python3(see this post). It was resolved, but I am not sure if the error in this post is related to that.
Any help or hint would be appreciated ;)
Thanks all for the prompt reply.
After Guo Lei’s comment, I tried downloading the tar ball for this package and installing it myself without pip, which eventually told me what exactly happened: a module named int-date, required by stockstats, was not installed in the python library directory. After I installed it in the proper directory, the issue is resolved.
As Danila Vershinin and phd had pointed out, I really shouldn’t run pip as root, and that is the source of issue(curiously, however, that only one particular module required by stockstats is installed in /root/.local/lib/. All others are in the right place, maybe I added the prefix flag without remembering it...?)
Still, I am not sure, I ran pip using sudo because I received permission denied errors repeatedly — so should I use something like sudo --user? Or sth else?
This works for me.
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple stockstats
or
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install stockstats
You can visit This website for Installing pip in centos 7 Pip Install In Centos 7
for maybe some errors in installing pip.
reinstall python.
check that the module name is correctly typed
install stockstats in pip like "pip install stockstats" (getten from pypi.com)
I install the python library named Python.NET package using pip install pythonnet, clr module is installed and imported, installation of qsharp module independently is done successfully but importing qsharp is displaying error.
Can anyone tell me why it is giving error while importing?
I am using spyder to run python code and anaconda for installation.
The process for installing qsharp is a little convoluted as you have to "install" it more than once.
The first install would be something like:
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
The second install (that trips some of us up) is you then have to also:
pip install qsharp
After that it should import correctly in Python.
Try
pip3 install qsharp
Then
python3 x.py
You have to be careful from the version of Python that you're using , if you have many versions on your computer delete them and let only the most recent one , however Q# is installed in 2 steps :
Installing package :
pip install qshart
Then installing kernel ( you'll need to install dotnet ) :
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
I was using VScode and getting this error very frequently. I realized that i needed to change the environment to the one in which qsharp was installed.. as it needed to be installed in different environment than base.
Also you will need to get the terminal to the directory where your code is.
Just posted as I did struggle with this early on.