Can't install python libraries - python

got a new laptop (MacBook Air with Catalina) and installed python 3 thru Homebrew.
When trying to install and run some libraries in a jupyter notebook (also installed thru Homebrew) like:
!pip3 install pandas
and then:
import pandas as pd
I get the error:
ModuleNotFoundError: No module named 'pandas'
Same thing with numpy, matplotlib, bs4, etc. Even though when I rerun the !pip3 install something I get the message:
Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (1.19.2)
When I run:
!which python3
!which pip3
I get
/usr/local/bin/python3
/usr/local/bin/pip3
is there something I'm doing wrong?

I’ve catch like this problem
It helped me that:
Uninstall python
And install python
Then reboot system
I guess your Catalina use 3 version py3 this time
It’s need realias
I guess on Mac OS is better to use pip3 by terminal.

Problem seemed to be installing jupyter thru homebrew. Uninstalled it, and then reinstalled it with pip and now everything is working

Related

Why do I get "ModuleNotFoundError: No module named 'pyperclip'" despite installing it with pip?

I get a "module not found" error when using idle while trying to import pyperclip.
In command terminal as administrator tried to install pyperclip using:
pip install pyperclip
Output was:
Requirement already satisfied: pyperclip in c:\users\ john smith\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.8.2)
I previously had anaconda navigator and jupyter notebook. I could import pyperclip in jupyter notebook. I deleted anaconda to try and see if it was because I had pyperclip installed in only location, but it did not solve the problem.
So where can I go from here?
edit :
I uninstalled python 3.7, as i had both 3.7 32 bit and 3.9 64 bit installed,
i ran the command : pip install pyperclip again in command
output :
Requirement already satisfied: pyperclip in c:\users\ john smith\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.8.2)
module still not found
edit: problem solved
went into the script for 3.9 and opened a cmd terminal
installed pip from there
thank you for your responses
It's possible that you're running two version of Python on your machine. Ex. a 2.7 and a 3.10. If you're on Windows, you can run the command py -0p to list all your python versions and their paths.
If you're looking to install pyperclip for a 3+ version of Python, you might want to use pip3 to install it.

ModuleNotFoundError: No module named 'kmodes'

I have tried installing it using pip install kmodes and it says that "Requirement is satisfied" but am not being able to import the library even after that.
The list of libraries doesn't have kmodes even after installing. Attaching screenshot for reference. What is happening here?
from kmodes.kprototypes import KPrototypes
ModuleNotFoundError: No module named 'kmodes'
Maybe your PIP is installing to the wrong version of python and the code you are running is being interreted by a later version
Try copying your python executable path and running this
C:\Users\username\AppData\Local\Programs\Python\Python39\python.exe -m pip install kmodes
Another reason is that kmodes did not install properly the first time
Try running this as an administrator
pip uninstall kmodes && pip install kmodes

How to fix 'DLL load failed while importing win32api' in Jupyter notebook after connecting VS code to Jupyter notebook?

When I try using Jupyter notebook, kernel error appears like this
import win32api
ImportError: DLL load failed while importing win32api:
After connecting vs code to jupyter notebook, error appears.
I've already tried
conda install pywin32
and copied the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 to C:\Windows\System32
but it didn't work.
how to fix?
Try installing it using pip, it can solve your problem here
pip install --upgrade pywin32==225
Or this, if you don't have the package already
pip install pywin32==225
After activating the env where the above is causing issue uninstall win32api (if it is installed):
pip uninstall pywin32
Then use pip to install pywin32:
pip install pywin32
Jupyter should work afterward. The solution is proposed here by ValentinVerschinin
Are you using Python 3.8? It seems to be a Python 3.8 specific problem.
Can you try to install the pywin32==225?
You can refer to this page.
Installing the relevant binary from github worked for me

how to install packages in python 3.3.1

I am new to Python and I have to use Python 3.3.1 version instead of latest one...
pip install numpy
it returns
SyntaxError: invalid syntax
I tried using the way i installed on python 3.6 but seems to be not working here..
I don't know how to install packages like numpy, pandas, scipy, sci-kit learn, matplotlib etc... in the Python 3.3.1, could you please help..?
Do i need to install pip separately... ?
Thanks in advance.
If you are in window try with:-
Open CMD and
python -m pip install numpy
If this is not working try with this
just type it as your python programe and run it
import pip
pip.main(["install","numpy"])
In my windows 10 machine, the pip.exe is in C:\Python36\Scripts folder. So I install required packages by either using command C:\Python36\Scripts\pip install package_name or first cd C:\Python36\Scripts and then pip install package_name. So far it worked me in different versions of pythons installed.
As suggested by ostue, please make sure that pip is installed with the python distribution.

import graph tool doesn't work on iPython

I installed graph-tool on ubuntu. When trying to import it in iPython I get an error:
ImportError: No module named graph_tool.all
As I read in other posts it might be possible that I used a different version of python for installing graph-tools than the system version I'm using. My question is now, how do I check which version graph-tool is installed with and how do i change this in order to import it?
Thanks for any advice!
If you install using pip you can check
pip -V
result (for example)
pip 8.0.2 from /usr/local/lib/python3.5/dist-packages (python 3.5)
You should have pip, pip2, pip2.7, pip3, pip3.4, etc. to install with different Python.
(in bash write pip and press tab twice to see all programs started with pip)

Categories