I want to plot using pm.traceplot(mcmc_trace,['theta']) in Google Colab but getting error:
ImportError: ArviZ is not installed. In order to use plot_trace:
pip install arviz
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
Whereas I have already installed Arviz and and import arviz which works but not able to plot.
Install via pip on Google ColLab will make the plot run of ArviZ again.
!pip install pymc3[plots] -q
Related
I am working on a machine learning project on Google Colab, it seems recently there is an issue when trying to import packages from transformers. The error message says:
ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' (/usr/local/lib/python3.7/dist-packages/torch/optim/lr_scheduler.py)
The code is simple as follow:
!pip install transformers==3.5.1
from transformers import BertTokenizer
So far I've tried to install different versions of the transformers, and import some other packages, but it seems importing any package with:
from transformers import *Package
is not working, and will result in the same error. I wonder if anyone is running into the same issue as well?
Change the torch version in colab by running this command
!pip install torch==1.4.0. Then, It worked for me.
Just change the version of tranformers to the latest one (4.5.1 at this time). That worked in colab.
!pip install transformers
The same issue occurred to me with the PyTorch version after being upgraded.
As for the solution downgrade Pytorch version to 1.4.0.
Use the below command to install
!pip install -q torch==1.4.0 -f https://download.pytorch.org/whl/cu101/torch_stable.html
It's solved a lot of problems with transformers also.
The above from udara vimukthi worked for me after trying a lot of different things, trying to get the code for "Getting started with Google BERT" to work after cloning the gitHub repository locally, so now ALL of the chapter code works while I'm showing my daughter the models.
Operating system - Windows. Running locally with GPU support, using Anaconda environment.
pip install -q --user torch==1.4.0 -f https://download.pytorch.org/whl/cu101/torch_stable.html
then I ran into some more issues and had to install the ipwidgets
pip install ipywidgets
Now it all works, as far as I've gotten. Thanks for the help with the above suggestion it saved me a lot of headaches. :)
Statsmodels is installed in my computer and I am trying to run some files from the terminal through python3
When I try to run a .py file with import statsmodels.api as sm I get an error
Any ideas on what the issue is?
did you do pip install statsmodels
or pip3 install statsmodels
it may have installed it to the wrong python version if you did not specify pip3
I'm having trouble importing statsmodels into my Jupyter Notebook where I'm running Python 3.8.3
My error: ModuleNotFoundError: No module named 'statsmodels'
Things I've tried:
pip install statsmodels
conda install statsmodels
pip install git+https://github.com/statsmodels/statsmodels
This is all done in my virtual environment, which is activated in the jupyter notebook I'm attempting the import in.
I've also attempted importing using import statsmodels.api as sm, import statsmodels.robust as rb as I saw some SO posts suggesting it, but I still get the same error.
When I type !conda list on my terminal, I see statsmodels in the available packages, yet I still can't import it.
Running out of ideas here, any help is appreciated
When I try to import geopandas package in "Google Colaboratory" I got the error "ModuleNotFoundError: No module named 'geopandas'".
I will appreciate your help. Thanks in advance.
Colaboratory comes with some non-base-Python packages "pre-installed"/already available for import. It doesn't include every single package however. For packages that aren't already included, like geopandas, you need to add a cell for installing the package:
% pip install geopandas
Run this cell before any cells where you want to import/use geopandas.
See also this SO thread (especially the answer by Doug Blank, a bit further down).
Check if geopandas is installed
>>> import sys
>>> 'geopandas' in sys.modules
To install the released version, you can use pip (in Google Colab, do not forget to include character ! before pip):
!pip install geopandas
Here is the notebook with only installing Gdal, geopandas and descartes to work ploting and spatial join.
Geopandas Colab
Try running !pip install geopandas in a new cell.
Don't forget the ! Exclamation mark.
Note:
This method works for other libraries too.
Simply !pip install 'package_name'
If you are running Python on your local machine, then open up Command Line and type pip install 'package_name' to install a package.
My OS is Ubuntu, and I've followed the official installation guide to install lightgbm. However, when I import it, this error is raised:
ImportError: No module named lightgbm
How can I solve this?
Do I also need to go to /python-package folder to run setup.py after running those linux commandlines?
I had the same problem, and solved running the installation directly on the notebook
!pip install lightgbm
Besides running those linux command lines. I also need to go to /python-package then run 'python setup.py install'.
conda install -c conda-forge lightgbm solved the problem for me
you need just run in a notebook cell before importing
For Windows users, VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572> is needed if Visual Studio (2015 or 2017) is not installed.
Install wheel <http://pythonwheels.com> via pip install wheel first. After that download the wheel file and install from it:
pip install lightgbm
The following should do the trick:
export PATH=/usr/local/bin/anaconda3/bin${PATH:+:${PATH}}
PYTHONPATH=$PYTHONPATH:/usr/local/bin/anaconda3/lib/python3.6/site-packages
Note that you might need to change the paths if you are using a different Python version.
Thank you for above question and answers, had a similar issue.
Problem:
After successfull install of lightgbm, I was getting the error ImportError: No module named 'lightgbm' (in Jupyter Notebook on Google Cloud's Notebook Instance in AI Platform project).
Issue:
Realized that the install of lightgbm was in Python 2.7 even when the notebook was running in Python 3 (path: './.local/lib/python2.7/site-packages').
Solution:
The error was gone after the Jupyter Notebook was set to run on Python 2 instead of Python 3.
within Jupyter Notebook cell is: try running
import sys
!{sys.executable} -m pip install lightgbm
With python try, from pypi.org, this line
pip install lightgbm
or
pip3 install lightgbm
Also, you can try this one if you use anaconda
conda install lightgbm