I'm getting below error when running 'import transformers', even though I have installed in the same vitual env. I'm using python 3.8
ModuleNotFoundError: No module named 'transformers'
Error:
enter image description here
I have uninstalled it and reinstalled it using 'pip3 install transformers' from python cmd line.
Then I tried to uninstalled again, and reinstalled in jupyter notebook using '!pip install transformers', result shows '
Installing collected packages: transformers
Successfully installed transformers-4.24.0
'
I can also verify directly in Jupyter Notebook:
enter image description here
I tried to install transformers successfully in jupyter Notebook. After that still getting ModuleNotFoundError error (have tried restarted kernel too)
enter image description here
its resolved now. I just tried to use %pip install transformers==3.4.0, instead of !pip install transformers==3.4.0 in jupyter book, and it worked. I can proceed with the project for now. Although I don't know what I did wrong in my python command line earlier that caused the inconsistency. Will open a new thread.
Related
I am going to use Bindsnet for Spiking Neural Network and I have imported it using
! pip install bindsnet in jupyter notebook.
and My Python's version is 3.6.
when I run:
from bindsnet.network import Network
It returns below error message:
ModuleNotFoundError: No module named 'bindsnet.network'
Can you please let me know how to solve this?
It turned out that using pip install was not successful so I changed the code for installation to :
!pip install bindsnet --ignore-installed
and now I can run from bindsnet.network import Network with no error.
I have been using Jupyter for some time now and it has worked just fine. I have Jupyter and Python installed via Homebrew. I am running on MacOS.
Yesterday, I ran the command brew upgrade and now my Jupyter notebook is unable to find any of the installed python packages. I will use Numpy as the example.
When inside of a Jupyter notebook, I try to do
import numpy
I get the message:
ModuleNotFoundError: No module named 'numpy'
If, however, I launch python in a terminal window, then I can import Numpy without issue.
I first checked that the package was installed correctly by re-issuing the install command
brew install numpy
which outputs:
Warning: numpy 1.18.4 is already installed and up-to-date
To reinstall 1.18.4, run `brew reinstall numpy`
I also ran
pip install numpy
and got:
Requirement already satisfied: numpy in /usr/local/lib/python3.7/site-packages (1.18.4)
Now, this is where I got confused because I expected the path to point to something like /usr/local/Cellar/, so I checked the path inside of the Jupyter notebook:
import sys
sys.path
which outputs:
['/Users/kseuro/Dropbox/Dev/',
'/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python38.zip',
'/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python3.8',
'/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python3.8/lib-dynload',
'/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8',
'',
'/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python3.8/site-packages',
'/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python3.8/site-packages/IPython/extensions',
'/Users/kseuro/.ipython']
Ok, so Homebrew wants Jupyter to use Python3.8? So I tried brew switch python 3.8 and got:
Error: python does not have a version "3.8" in the Cellar.
python's installed versions: 3.7.7
I feel like I'm out of my depth now and need help figuring out what to do next. I don't want to start by just changing paths around.
Suggestions? Thanks so much.
I figured out what to do — posting the solution for my future self and others who may stumble upon this.
Since Jupyerlab is in its own Cellar, the Python packages need to end up in the
/usr/local/Cellar/jupyterlab/x.y.z/libexec/lib/python3.x/site-packages
directory, where x, y, z are integers, so that the Jupyter kernel can find them.
You can do this by calling:
import sys
!{sys.executable} -m pip install 'package-name'
inside of the Jupyer notebook.
All is well, again.
I'm trying to display data using a pie chart in python, so i tried to install matplotlib using pip. After doing that, I tried importing matplotlib but I get an error: ModuleNotFoundError: No module named 'matplotlib'.
In the Command Prompt I typed 'pip install matplotlib' and everything appeared to be successful. This is the last line:
Successfully installed backports.functools-lru-cache-1.5 cycler-0.10.0 kiwisolver-1.0.1 matplotlib-2.2.4 numpy-1.16.2 pyparsing-2.3.1 python-dateutil-2.8.0 pytz-2018.9 six-1.12.0
I've also tried 'python -m pip install -U matplotlib', but I still get a ModuleNotFoundError.
I've tried running the input statement in both python 3 and 2, neither worked.
I've looked at various different discussions on this, and none of them seemed to help me. How can I fix this?
There are various python installed in your OS. If you install matplotlib for somewhere the python that you are using does not search, you get importing errors. You should figure out which python you want to use and where the packages it searches.
check your python path. the matplotlib should be installed in the same path with your python environment.
I guess you use an IDE to run the python. some IDE have their own python environment.
if not solved. plz introduce some details about your system、how installed etc.
I am trying to use OpenAI and I got a import error about universe on Jupyter notebook :
import gym
import universe
No module named 'universe'
When it comes to working on terminal, it returns this error
No module named 'twisted.internet'
Then I also had install twisted with pip, I got this next error :
No module named 'ujson'
and after install ujson, I got a error No module named 'go_vncdriver' again.
I think that I will get other error again.
So which way to install is most convenient ?
Could I install all packages at once ?
préferably, using pip install.
I am using OSX and python3.6.
Try installing,
pip install go_vncdriver
And check again.
I'm trying to parse the following line of code in an iPython notebook.
from Ipython.display import display, Image
I get the following error,
ModuleNotFoundError: No module named 'Ipython'
When I run pip3 install Ipython
Here's what I get.
Requirement already satisfied: Ipython in ./.envs/dl/lib/python3.6/site-packages
I'm running the code in the same virtual env in which ipython is installed. What am I missing. My python version is 3.6.
Its from IPython.display import display, Image
'P' also caps in IPython
I had this problem too. You have to pay attention to which python version you are using, which pip version, and which environment too. I made a stupid mistake at first and installed TensorFlow on a virtualenv, then tried to call IPython which means my function and installation had different paths.
I recommend using "python -m pip install"