How do I find and use my imported modules? - python

I am very new to python, and this is one of my first projects. I now use PyCharm, but started with Anaconda and jupyter notebook. When i try to import a module into my project, i get this error:
import stdiomask
stdiomask.getpass('Password: ')
/Users/Kristoffer/.conda/envs/Prosjekt_beginner/bin/python "/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler/modultest.py"
Traceback (most recent call last):
File "/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler/modultest.py", line 1, in <module>
import stdiomask
ModuleNotFoundError: No module named 'stdiomask'
After searching the internet for answers, I am still lost, but suspect it has something to do with my pythonpath. Anaconda might also have something to do with it. As I said I just started with python, so I do not know whether this is enough information to solve my problem, but this is what i did:
Checking if the module is installed with both pip and pip 3:
(base) KKWs-MBP-2:~ Kristoffer$ pip install stdiomask
Requirement already satisfied: stdiomask in ./opt/anaconda3/lib/python3.8/site-packages (0.0.6)
(base) KKWs-MBP-2:~ Kristoffer$ pip3 install stdiomask
Requirement already satisfied: stdiomask in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (0.0.6)
WARNING: You are using pip version 20.2.3; however, version 20.3.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command.
And then i checked which version of python I am using and got two different answers.
(base) KKWs-MBP-2:~ Kristoffer$ python
Python 3.8.3 (default, Jul 2 2020, 11:26:31)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
(base) KKWs-MBP-2:~ Kristoffer$ python3
Python 3.9.0 (v3.9.0:9cf6752276, Oct 5 2020, 11:29:23)
[Clang 6.0 (clang-600.0.57)] on darwin
I then typed in this in PyCharm and got:
import sys
print(sys.path)
/Users/Kristoffer/.conda/envs/Prosjekt_beginner/bin/python "/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler/modultest.py"
['/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler', '/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python38.zip', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python3.8', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python3.8/lib-dynload', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python3.8/site-packages']

So As You Said You are using Anaconda So when you are doing pip3 install stdiomask or pip install stdiomask you are installing it on your real python enviroment & as you mentioned you are using anaconda enviroment,
so give this command conda install stdiomask
Or visit This Website And Read...
I Hope it Helped
Jai Hind Jai Bharat

Unfortunately, when using pip or pip3 to install packages, these are python modules, but also binaries, and using them like:
pip install <package>
or
pip3 install <package>
Doesn't explicitly tell you which interpreter pip is pointing to. However, executing a module using python -m <module> uses the python in your path, and is explicit. You've already seen that the pip -V site-packages is different than your interpreter's site-packages. The way to get around this is to use pip as a module:
python -m pip install <package>
Then you know that you are using the python that you currently have activated

Related

Difficulty installing/importing pyqt5 on ubuntu 18.04

Goal: To import pyqt5 into python3 under Ubuntu 18.04
I know there are many answers to similar questions here and elsewhere. I have tried a lot of them, but I don't see anything that exactly matches my situation.
Starting with a clean installation of Ubuntu 18.04, I have tried many ways to be able to have the statement import pyqt5 succeed in Python 3.6.9, which is the default python3 on this distribution.
None of them have succeeded.
In several attempts, reinstalling Ubuntu anew several times, I have had pip3 either experience a 404 downloading https://pypi.org/simple/python3-pyqt5/ and confirmed the error by pasting the URL into Firefox and also getting a 404. (I also checked the Firefox was working fine accessing the Internet)
But usually I run through a process that seems to indicate that pyqt was loaded successfully but was still unable to import it in Python3.
Among the things I've tried from various web sites are:
pip3 install --upgrade pip
pip3 install pyqt5==5.14.0 vs pip3 install pyqt5 (defaulting to 5.14.1)
installing a simple pypi module and finding that I can import it into Python3 with no problem
running pip3 under sudo
upgrading python3 to Python 3.7.4
A more complete list of what I did starting with the reinstall is shown below.
Any suggestions for solutions or what to look at on my system?
I have a bootable memory stick of Ubuntu 18.04.4 that I created last week by downloading the executable from Ubuntu.com. Everything that's packaged with the release seems to work fine, including Python 3.6.9 in other situations. I do virtually nothing except the following steps.
sudo apt install python3-pip
pip3 install humanfriendly (just to ensure that pip3 works for a simply pypi module)
pip3 install --upgrade pip
pip3 install python3-pyqt5
sudo apt-get install pyqt5-dev-tools (no complaints from pip3 seems to work okay)
sudo apt-get install qttools5-dev-tools (seems to work)
in python3
>>>import pyqt5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyqt5'
pip3 uninstall pyqt5 (Successfully uninstalled PyQt5-5.14.0)
pip3 install pyqt5 --user (Successfully installed pyqt5-5.14.1
Try to import in python3 again, same result: "No module named 'pyqt5'"
cd ~/.local/bin
ls
humanfriendly pip pip3 pip3.6 pylupdate5 pyrcc5 pyuic5
(there seems not to be an entry for pyqt5 although there is for some of its stand-alone componentes)
pip3 uninstall pyqt5
ls
humanfriendly pip pip3 pip3.6
(what was there went away)
pip3 uninstall pyqt5 (Successfully uninstalled PyQt5-5.14.1)
pip3 install pyqt5 --user (seems to succeed)
try to import in python3 (same error)
pip3 uninstall pyqt5 (Successfully uninstalled PyQt5-5.14.1)
next I tried sudo pip3 uninstall pyqt5
seems to work; not importable in python3; sudo pip3 uninstall
next I created a virtual env, ~/.vents/tevs
activate the venv
pip3 install pyqt5==5.14.0
Installing collected packages: PyQt5-sip, pyqt5
attempt to import pyqt5 in python3: fails as before
pip3 uninstall pyqt5
(Successfully uninstalled PyQt5-5.14.0 after listing thousands of files
in .venvs/tevs/lib/python3.6/site-packages/PyQt5)
pip3 install python3-pyqt5
(fails with HTTP Error: 404 Client Error:
Not Found for url: https://pypi.org/simple/python3-pyqt5/)
Several problems should be noted in what the OP notes:
The name of the library does not necessarily match the name of how to import the libraries, on the other hand pip accepts names like pyqt5 and PyQt5 as equivalent, but when you import it you should use PyQt5, not pyqt5, so to test that you have installed you can do the following:
Run on the console:
$ python3 -c "from PyQt5.Qt import PYQT_VERSION_STR; print(PYQT_VERSION_STR)"
5.14.1
Run on python console:
Python 3.8.1 (default, Jan 22 2020, 06:38:00)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> print(PYQT_VERSION_STR)
5.14.1
python3-pyqt5 is the name of the package that offers ubuntu repositories for the version of pyqt5 that your community compiles which is generally a non-current version. So to install pyqt5 there are several methods:
Using ubuntu repository: sudo apt-get install python3-pyqt5
Using pip: python3 -m pip pyqt5 (You must use sudo if required) or python3 -m pip install pyqt5 --user (This method also applies to virtualenv)
So I can conclude that the OP has successfully installed PyQt5 but has failed to verify if the installation has been correct so I recommend using what is indicated in (1)
I recently encountered this problem on Ubuntu 20.04 and here is what worked for me.
Firstly, after trying much of what you described I finally decided to run python --version from terminal and the output told me that python 2.7 was the default version on my system. This was the problem.
Secondly, after thinking "sheeeee-*t partner", I checked for any python2 dependencies using apt rdepends python --installed.
Lastly, after confirming that I had no python2 dependencies, I ran sudo apt-get install python-is-python3 in order to make python3 the default version.

Module installed with PIP in virtualenv not found

Getting a very strange error. I am making a virtual environment and initializing it with a pip requirements.txt file, but when I go to run code in the activated environment, the virtual environment interpreter claims to be missing some (and only some) of the modules:
(venv) $ pip list
certifi (2017.7.27.1)
chardet (3.0.4)
decorator (4.1.2)
idna (2.5)
ipython (6.1.0)
ipython-genutils (0.2.0)
jedi (0.10.2)
numpy (1.13.1)
olefile (0.44)
pexpect (4.2.1)
pickleshare (0.7.4)
Pillow (4.2.1)
pip (9.0.1)
prompt-toolkit (1.0.15)
protobuf (3.3.0)
ptyprocess (0.5.2)
Pygments (2.2.0)
PyYAML (3.12)
pyzmq (16.0.2)
requests (2.18.3)
scipy (0.19.1)
setuptools (38.5.1)
simplegeneric (0.8.1)
six (1.10.0)
torch (0.2.0.post3)
torchvision (0.2.0)
tornado (4.5.1)
tqdm (4.15.0)
traitlets (4.3.2)
urllib3 (1.22)
visdom (0.1.5)
wcwidth (0.1.7)
wheel (0.30.0)
So I double check:
(venv) $ pip install tqdm 
Requirement already satisfied: tqdm in ./venv/lib/python3.6/site-packages
(venv) $ python  
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tqdm import tqdm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tqdm'
people have suggested forcing a reinstall, using a different interpreter source, and just reinstalling. None of these have worked. this is very mysterious. Have any of you seen anything like this? Saw a similar unresolved problem here
UPDATE: Fixed. H/T to #Riverman for helping my find the issue: the problem was that an old unused alias was left over from a while ago, and while pip still had it own point back to python3.6, the python command itself was aliased to some old Anaconda3 version I had lying around somewhere. Alias, I forgot, do not go away by just re-sourcing your .bashrc file, so I ran unalias with the offending python command and it worked!
Would still love to hear from people though if they could explain why this can occur, though. I though venv completely insulated you from the outside environment...is it because aliasing is a system level effect so it seeps into the venv??
While being inside the virtualenv, please issue the following commands:
pip freeze
pip -V
python -V
which python
which pip
Share your results here to analyze it. I've also experienced pretty similar issues with the requests package before, but that happened on windows to me.
You used pip(which installs for Python 2.7) and you are trying to import the installed package in Python3 so it wont work.
You should do pip3 install package-name .
pip3 installs for Python3. Install pip3 using apt-get install python3-pip
It will work.
I had a very similar problem: I was working on a virtual environment (virtualenv) and installed pandas inside this environment with:
pip3 install pandas
However, when I tried to import this module when working on a jupyter notebook that was also inside this virtual environment with the command:
import pandas as pd
I was getting the error:
ModuleNotFoundError: No module named 'pandas'
Finally, I noticed that, even though I was activating my jupyter notebook from inside my virtual environment, I was opening the jupyter notebook from outside my virtual environment (because I also had this module installed outside of all my virtual environments). My solution was to uninstall jupyter that was outside my virtual environments and when I ran again the juypter nb from inside the desired environment everything worked perfectly.

Errors on importing tensorflow on raspberry pi 3 [duplicate]

I have just reinstalled latest tensorflow on ubuntu:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl
[sudo] password for ubuntu:
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tensorflow==0.7.1 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl
Downloading https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl (13.8MB)
100% |████████████████████████████████| 13.8MB 32kB/s
Requirement already up-to-date: six>=1.10.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1)
Requirement already up-to-date: protobuf==3.0.0b2 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1)
Requirement already up-to-date: wheel in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1)
Requirement already up-to-date: numpy>=1.8.2 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1)
Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages (from protobuf==3.0.0b2->tensorflow==0.7.1)
Installing collected packages: tensorflow
Found existing installation: tensorflow 0.7.1
Uninstalling tensorflow-0.7.1:
Successfully uninstalled tensorflow-0.7.1
Successfully installed tensorflow-0.7.1
When following the directions to test it fails with cannot import name pywrap_tensorflow:
$ ipython
/git/tensorflow/tensorflow/__init__.py in <module>()
21 from __future__ import print_function
22
---> 23 from tensorflow.python import *
/git/tensorflow/tensorflow/python/__init__.py in <module>()
43 _default_dlopen_flags = sys.getdlopenflags()
44 sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL)
---> 45 from tensorflow.python import pywrap_tensorflow
46 sys.setdlopenflags(_default_dlopen_flags)
47
ImportError: cannot import name pywrap_tensorflow
Is there an additional change needed to my python or ubuntu/bash environment?
From the path in your stack trace (/git/tensorflow/tensorflow/…), it looks like your Python path may be loading the tensorflow libraries from the source directory, rather than the version that you have installed. As a result, it is unable to find the (compiled) pywrap_tensorflow library, which is installed in a different directory.
A common solution is to cd out of the /git/tensorflow directory before starting python or ipython.
The command below helped me.
pip install tensorflow --upgrade --force-reinstall
I compiled, installed TensorFlow from source (GitHub: https://github.com/tensorflow/tensorflow) in a Python 2.7 virtual environment (venv). It worked fine, but I needed (as others have mentioned, e.g. user "mrry" at Error running basic tensorflow example) to cd out of the partition in which I had compiled TensorFlow, to another partition, in order to be able to import tensorflow into Python. Otherwise, I got various errors, depending on which (source partition) directory I was in. To clarify:
source: /mnt/Vancouver/apps/tensorflow
can't import tf: Python launched in any of /mnt/...
can import tf: Python launched in /home/victoria/...
I later just followed the instructions here,
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#anaconda-installation
and everything just works, fine.
For reference, I am operating on
Arch Linux [4.6.3-1-ARCH] x86_64
Intel i7-4790
xfce 4.12 desktop environment
INSTALL STEPS:
Modify paths, venv names as per your preferences.
Create tf-env:
cd /home/victoria/anaconda3/envs
conda create -n tf-env python=2.7 anaconda
Note: appending the 'anaconda' metapackage installs ALL Anaconda packages (NumPy; ...).
Source activate that venv (tf-env)
source activate tf-env
Note: added to ~/.bashrc as an alias:
alias tf='echo " [TensorFlow in Anaconda Python 2.7 venv (source activate tf]" && source activate tf-env'
Install TensorFlow in the tf-env venv:
(tf-env)$ conda install -c conda-forge tensorflow
THIS obviates the use of pip (including the *.whl install script), an alternative approach to installing TensorFlow that is described here:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md).
WORKS!
(tf-env)[victoria#victoria ~]$ P
[P: python]
Python 2.7.12 |Anaconda 4.1.1 (64-bit)| (default, Jul 2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow
>>> print tensorflow.__version__
0.9.0
>>> [Ctrl-D]
(tf-env)[victoria#victoria ~]$
You may then work with TensorFlow in the tf-env; e.g., in Jupyter notebooks launched in this (tf-env) venv.
Tensorflow 2.0 Compatible Answer: Both mrry's solution and neustart47's work for Tensorflow Version >= 2.0.
Answer 1: cd out of the /git/tensorflow directory before starting python or ipython.
Answer 2: pip install tensorflow --upgrade --force-reinstall or
!pip install tensorflow==2.0 --force-reinstall
In my python -m venv environment it appeared to be fixed by:
pip uninstall tensorflow
Change requirements.txt to say tensorflow==1.5.0 instead of tensorflow==1.8.0.
pip install -r requirements.txt
if you using CPU manufactured before 2011 then downgraded the tensorflow version from 1.8.0 to 1.5.0 or 1.2.0 and try to import the module it worked for me.
Installing via the following command solves the problem:
pip install --upgrade
Here's the link to download
I figured out that TensorFlow 1.12.0 only works with Python version 3.5.2. I had Python 3.7 but that didn't work. So, I had to downgrade Python and then I could install TensorFlow it works.
To downgrade your python version from 3.7 to 3.6
conda install python=3.6.8
I'm using tensorflow 1.13.1. Just reinstalling tensorflow worked for me.
I also have this issue and have been looking into it for a long time. It seems that there is no such problem on python 3+. On py2.7- The problem is actually on google.protobuf
Solution 1:
pip uninstall protobuf
pip uninstall google
pip install google
pip install protobuf
pip install google-cloud
Solution 2:
create an __init__.py in "google" folder.
cd /path/to/your/env/lib/python2.7/site-packages/google
touch __init__.py
Hopefully it will work.
I resolve the problem.
Try the follow command:
pip install --upgrade pip

Installing Biopython: ImportError: No module named Bio

trying to install Biopython on Fedora 21, Python 2.7. I've done the following
[mike#localhost Downloads](17:32)$ sudo pip2.7 install biopython
You are using pip version 6.1.1, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting biopython
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading biopython-1.65.tar.gz (12.6MB)
100% |████████████████████████████████| 12.6MB 33kB/s
Installing collected packages: biopython
Running setup.py install for biopython
Successfully installed biopython-1.65
And then
[mike#localhost Downloads](17:32)$ ipython
Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar 9 2015, 16:20:48)
In [1]: import Bio
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-a7440e1156be> in <module>()
----> 1 import Bio
ImportError: No module named Bio
What am I doing wrong?
EDIT
I tried installing biopython using
sudo easy_install -f http://biopython.org/DIST/ biopython
and it installed it into /usr/lib/python2.7/site-packages/biopython-1.65-py2.7-linux-x86_64.egg/. Didn't work.
Then I tried installing it using the same command, without the sudo:
easy_install -f http://biopython.org/DIST/ biopython
which installed it into /home/mike/anaconda/lib/python2.7/site-packages/biopython-1.65-py2.7-linux-x86_64.egg
And that worked! Both for ipython and python. But why did it work...?
One should be very careful when using pip and the like that it is the pip which goes along with the supposed Python interpreter.
I see that you are trying to import Bio from the Python interpreter you get by typing ipython. You can make sure that you invoke the pip of exactly this interpreter like so:
sudo ipython -m pip install biopython
Note that the installation is not exclusive to ipython. It is however exclusive to whatever Python installation ipython is installed on top of.
It's not good practice to sudo pip, since it may install things under root permission, which is usually not granted to ordinary program.
The problem probably lies in library path. The most informative tools will be
import sys
print (sys.path)
and
which python
pip --version
And use pip install biopython --user to replace sudo pip

Python can't find module NLTK

I followed these instructions http://www.nltk.org/install.html to install nltk module on my mac (10.6)
I have installed python 2.7, but when I open IDLE and type import nltk it gives me this error
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import nltk
ImportError: No module named nltk
The problem is the module is installed in another python version, 2.6. How can I install the package in python version 2.7? I tried some of the solutions suggested in various answers, for example I tried typing this in the terminal
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
and then installed NLTK again with the command
sudo pip install -U nltk
but I get the message: Requirement already up-to-date in /Library/Python/2.6/. So apparently the command line export PYTHONPATH didn't do anything (it still tries to install the package in 2.6) OR (more likely) I didn't understand the meaning/functioning of that command line. What am I doing wrong?
On OS X you could have multiple installation of Python, so investigate it first:
$ which python python2 python3
/usr/bin/python
/usr/local/bin/python3
$ which pip pip2 pip3
/usr/local/bin/pip
/usr/local/bin/pip2
/usr/local/bin/pip3
All within /usr/bin are built-in and all other in /usr/local/bin are external installed by Homebrew or some other package manager.
If you're using pip or pip3 from /usr/local, then you've to use the same Python instance, otherwise they're different instances.
Just install it via pip:
pip install nltk
or for Python 3:
pip3 install nltk
then run the right Python instance from /usr/local/bin or update your PATH system variable.
Make sure you install the actual Python for Mac, not the one built into the console. Then, install pip by executing this script. Then skip to part 3 of the instructions and go from there.
Try this
pip install --user -U nltk
On my mac I had two different versions of Python 3 installed: Python 3.6 and Python 3.7. I had installed nltk having Python 3.7 in my $PATH:
$ pip3 install nltk
$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
But nltk was missing for Python 3.6. Solution: install nltk also for version 3.6.
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ pip3 install nltk
Collecting nltk
Using cached https://files.pythonhosted.org/packages/6f/ed/9c755d357d33bc1931e157f537721efb5b88d2c583fe593cc09603076cc3/nltk-3.4.zip
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nltk) (1.12.0)
Collecting singledispatch (from nltk)
Using cached https://files.pythonhosted.org/packages/c5/10/369f50bcd4621b263927b0a1519987a04383d4a98fb10438042ad410cf88/singledispatch-3.4.0.3-py2.py3-none-any.whl
Installing collected packages: singledispatch, nltk
Running setup.py install for nltk ... done
Successfully installed nltk-3.4 singledispatch-3.4.0.3
I would use a virtualenv, but if you really want to use it from the terminal, I'd recommend adding your export statement to ~/.bashrc
Just restart Jupyter Notebook or anything you are using after installing...
It works...
In my case, the following command worked for me. Try this!!
py -3 -m pip install nltk
I had a similar issue an an Intel MacBook.
Fixed with
Make sure the python bin directory in the path
mine is /Users/<user>/Library/Python/3.9/bin
Restart the computer
NOTE that just restarting the terminal did NOT help

Categories

Resources