I recently upgraded from Python 3.8.5 to Python 3.11.2. I updated my pip and pip3 to use the correct directory. However, when I run my previously existing code from Jupyter notebook, I get: "ModuleNotFoundError: No module named 'requests'". I tried uninstalling and installing requests, updating Jupiter notebook, and installing requests again using brew and nothing worked. The same goes for the Ta-lib library. Was wondering what I was doing wrong thanks.
Related
Did pip install pdfrw, uninstalled and reinstalled, restarted my laptop, but still unable to import the specified package as it returns error: No module named 'pdfrw'.
https://pypi.org/project/pdfrw/#pdfrw-philosophy
Any advice is appreciated.
Update: Tried installing by cmd, I'm using Jupyter Notebook as IDE :)
You have to make sure that the Python that you are using with Jupyter Notebook is the same that the one for which you are installing that package. If you have several Python interpreters installed or if you installed Ananconda to use Jupyter, you have to take care of which pip are you invoking from CMD.
If you are using Jupyter from Ananconda, try to install the package using conda.
conda install pdfrw
Another thing that you can do is open a Command Prompt and type:
where python
you will get the path to the interpreters that you have installed. In my case I get:
>>> C:\Windows\system32>where python
C:\Python39\python.exe
C:\Python38\python.exe
>>> C:\Windows\system32>where pip
C:\Python39\Scripts\pip.exe
C:\Python38\Scripts\pip.exe
Then you can use a concrete interpreter to call pip, in my case I will do:
C:\Python39\python.exe -m pip install pdfrw
After the installation finish, invoke the same interpreter you use to call pip:
C:\Python39\python.exe
Then try to import pdfrw. If you can import it, then the problem is that you are using a different interpreter in Jupyter Notebook.
I first installed Spyder and then afterwards Python on a server (with Windows Server 2019) all on the directory "C:\Users\wi932\ .spyder-py3" and the Python folder "C:\Users\wi932\Python\Python38". Then I installed many packages (like tensorflow, matplotlib, scikitlearn) by using the command prompt of windows and pip from the directory "C:\Users\wi932\Python\Python38\Scripts" and it was okay.
However, when running Spyder I can't use the packages that I installed using pip. Whenever I run a Python programm with those modules I get an error message "ModuleNotFoundError: No module named 'tensorflow'". So the question is how can I build a "connection" between the pip and Spyder?
Does anyone have an idea? I'll appreciate every comment.
Have you considered installing anaconda?
Spyder comes as a part of this and is easy to install from the anaconda client. You can also create your base environment in the anaconda client and then switch to pip to install packages from there.
I pip installed several packages (opencv, face_recognition, imutils)
They were all successfully installed, but are not recognized
I have a python script named script.py which imports cv2, but when I run it I get the following:
ModuleNotFoundError: No module named 'cv2'
I tried using pip list command to see the packages I have installed, but the packages I installed are not showing as you can see below.
I run pythonVersion.py to check my python version, it says it's using 3.8.2 which is where my packages are stored, as shown below.
I tried using #!/Users/Khuzama/opt/anaconda3/lib/python3.8 (the path of my packages) in my script, but still the same issue.
I am using jupyter notebook (anaconda navigator)
It is most probably the python environment you installed the packages are not the one you are currently referring to.
Try seeing the output of
which python
if this doesn't point to the anaconda one, then navigate to Users/Khuzama/opt/anaconda3/lib/python3.8 and run your script from there. Alternatively you can link the python from anaconda as the main python for your system
I'm new to python trying to figure out some basics. I installed python 3.5 and then, to use jupyter notebook I installed anaconda distrubition. After that, I installed pycharm and started learning python.
After a few weeks, I was able to create a simple project which makes use of pyqt5. My project runs when I run it from pycharm itself, but when I try to run it with "python" command from cmd I get an error, stating that import from pyqt5 has failed. I did some research, and installed pyqt5 using pip, but the problem persists.
So what should I do to run my project without anaconda, using python 3.5?
It seems the anaconda distrubution and python itself were conflicting. Whenever I tried to install a module using pip (like pyqt5), it is installed under anaconda's python so when I try to invoke my own python from console i failed to use those installed modules. Hence there seems to be two option;
Delete all python related stuff from the computer and clean install python only - no anaconda. (I did this)
Or when installing a module, try using different pip's for the two python distrubutions on our computer. Check this link: Install a module using pip for specific python version
I signed up for a statistics udemy course which uses jupyter running the stock numpy package out of anaconda.
Numpy is working when I run python 3.4.4 in pycharm, but it will not work in either anaconda2 nor anaconda3.. this makes no sense because numpy comes stock as part of the anaconda library.
When I try importing numpy in jupyter, running a local instance of a python 2 script, I get this:
Thinking I could sidestep the error using a IDE, I tried pycharm and I got this:
Numpy is part of the anaconda default library which I'm running, so I checked and made sure the numpy package was there via the Anaconda Prompt using 'conda list'...
Why won't it import successfully?
Before I uninstall and reinstall everything, does anyone have any ideas?
Yayyyy. I figured it out. So I had several different python versions before I was running python through anaconda/jupyter. As a result, the tethering in-between the additional package libraries to the version of python running was shifty. For example, I may have had numpy working configured to 3.4 but not 2.7..
anyways, to break down the steps I took, I uninstalled all instances of python (both anaconda and normal versions). Then I deleted the old 3.4 libraries from my C drive. Then I installed anaconda 2.7.11 again, tested importing numpy and got the same error. Then I thought to myself, what if the packages are installed separate from the python library and their configuration didn't get reset via the reinstall.. so via the anaconda prompt I typed:
pip uninstall numpy
which removed the package I was having trouble with. and then :
pip install numpy
which downloaded and reset a whole new instance of the package. Then I tested importing numpy in both the anaconda prompt and jupyter = both worked.
I'm very happy that this ended up working out as I can continue on as planned. For anyone else who experiences a similar problem, I would try uninstalling, then reinstalling the problem causing package via pip commands - this step seemed to have the most impact on fixing the problem. Then if that doesn't work proceed to uninstall and reinstall the environments in intervals.
You can try using the following command:
pip install numpy --upgrade
This will uninstall old installed version of numpy and install a new version. This command solved my issue.
try activating you base conda environment before starting jupyter.
>activate root
>jupyter notebook