I am trying to import seaborn as sns on EC2 AWS ipython notebook.
But I am getting the following error. Please help
import seaborn as sns
ImportError Traceback (most recent call last)
in ()
----> 1 import seaborn as sns
ImportError: No module named seaborn
You may first want to download seaborn package. It is not available by default with python installation.
Use pip to download :
pip install seaborn
Additionaly, you can try installing anaconda
$ curl -O https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh
$ chmod 777 Anaconda3-4.3.1-Linux-x86_64.sh
$ ./Anaconda3-4.3.1-Linux-x86_64.sh
... (Press enter/yes where ever required )
$ conda install seaborn
Related
I am a new learner to Federated Learning. I tried to start with tutorial "Federated Learning for Image Classification" on Colab but met some problems. When I installed TensorFlow and TensorFlow Federated,
##test {"skip": true}
# tensorflow_federated_nightly also bring in tf_nightly, which
# can causes a duplicate tensorboard install, leading to errors.
!pip uninstall --yes tensorboard tb-nightly
!pip install --quiet --upgrade tensorflow-federated-nightly
!pip install --quiet --upgrade nest-asyncio
!pip install --quiet --upgrade tb-nightly # or tensorboard, but not both
import nest_asyncio
nest_asyncio.apply()
some error occurs
ERROR: tensorflow 2.5.0 requires tensorboard~=2.5, which is not installed.
ERROR: tensorflow 2.5.0 has requirement grpcio~=1.34.0, but you'll have grpcio 1.37.1 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement keras-nightly~=2.5.0.dev, but you'll have keras-nightly 2.7.0.dev2021071300 which is incompatible.
ERROR: spacy 2.2.4 has requirement tqdm<5.0.0,>=4.38.0, but you'll have tqdm 4.28.1 which is incompatible.
ERROR: pymc3 3.11.2 has requirement cachetools>=4.2.1, but you'll have cachetools 3.1.1 which is incompatible.
ERROR: fbprophet 0.7.1 has requirement tqdm>=4.36.1, but you'll have tqdm 4.28.1 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.
ERROR: tensorflow-privacy 0.6.1 has requirement attrs>=21.2.0, but you'll have attrs 19.3.0 which is incompatible.
I see some similar question regarding these errors and then run the rest of cells. However, when it comes to code
import collections
import numpy as np
import tensorflow as tf
import tensorflow_federated as tff
Errors occur again:
ImportError Traceback (most recent call last) <ipython-input-3-a23308ec3f7c> in <module>()
3 import numpy as np
4 import tensorflow as tf
----> 5 import tensorflow_federated as tff
6
7 np.random.seed(0)
28 frames
/usr/local/lib/python3.7/dist-packages/keras/api/_v2/keras/__init__.py in <module>()
8 import sys as _sys
9
---> 10 from keras import __version__
11 from keras.api._v2.keras import __internal__
12 from keras.api._v2.keras import activations
ImportError: cannot import name '__version__' from 'keras' (/usr/local/lib/python3.7/dist-packages/keras/__init__.py)
I am not familiar with TensorFlow Federated. Has anyone else faced same issue? Need pointers to resolve this.
Start with a clean runtime and add a code section with the following:
!pip uninstall tensorflow keras -y
Run this before you run anything else, and restart your runtime. Then you can run the rest of the tutorial.
I am using Google Colab. I have installed the PyGMT. Now, I want to install the Geopandas but I got lots of errors when i type "!pip install geopandas" or "!conda install geopandas". Can you help me to install geopandas in googlecolab?
Here is my code;
from google.colab import drive
drive.mount('/content/drive')
import os
import sys
import os
sys.path.append('/usr/local/lib/python3.8/site-packages')
os.environ["GMT_LIBRARY_PATH"]="/usr/local/lib"
!wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local
!conda update conda -y -q
!conda config --prepend channels conda-forge
!conda install -q -y --prefix /usr/local python=3.8 pygmt
import sys
import os
sys.path.append('/usr/local/lib/python3.8/site-packages')
os.environ["GMT_LIBRARY_PATH"]="/usr/local/lib"
!pip install geopandas
import pygmt
import pandas as pd
import geopandas
When I do !pip install geopandas and import it, it says that: ModuleNotFoundError: No module named 'pyproj._network'
have you tried using
!pip install --upgrade geopandas
don't forget to also update the other dependencies
!pip install --upgrade pyshp
!pip install --upgrade shapely
!pip install --upgrade descartes
Found it in this Google Colab tutorial, https://colab.research.google.com/drive/1We-LMiSeucESsiB1tmvL9nZrntyWsri-#scrollTo=xIXl9KBOxVKE
Hope it works,
Conda is not available in google colab by default like numpy, pandas etc is. So doing !conda install geopandas won't do any help. There's another way around it though. You CAN install conda on google colab and using it you can install other packages. Here's how:
!pip install -q condacolab
import condacolab
condacolab.install()
Then try installing with !conda install geopandas and import it using import geopandas
You can use these three lines to import geopandas in colab:
!apt install libspatialindex-dev
!pip install rtree
!pip install geopandas
I'm using Python 3.5.2 on Ubuntu 16.04.
I've installed sklearn using..
sudo apt install python-sklearn
and mlxtend using...
sudo pip3 install mlxtend
I'm trying to run the basic Iris example found on the Internet, but I am getting an error as soon as I try to import plot_decision_regions from mlxtend.plotting:
from mlxtend.plotting import plot_decision_regions
Traceback (most recent call last):
File "scripts/machine.learning.py", line 6, in <module>
from mlxtend.plotting import plot_decision_regions
File "/usr/local/lib/python3.5/dist-packages/mlxtend/plotting/__init__.py", line 15, in <module>
from .heatmap import heatmap
File "/usr/local/lib/python3.5/dist-packages/mlxtend/plotting/heatmap.py", line 74
raise AssertionError(f'len(row_names) (got {len(row_names)})'
^
SyntaxError: invalid syntax
I had the same error, just upgrade to python3.7 the real error is
python 3.5 does not support f prefix
upgrade using conda
conda install -c anaconda python=3.7
and then update all depencies
conda update --all
I'm not seeing the same error as you, but try remove legend=range(105, 150) from plot_decision_regions i.e.
plot_decision_regions(x_combined, y_combined, clf=tree)
I'm using the latest current sklearn, i.e.
import sklearn
sklearn.__version__
'0.21.3'
Perhaps remove that version
sudo apt-get remove python-sklearn
Then install via pip, i.e.
pip3 install scikit-learn
I get the following error when trying to import Google Cloud Logging in Python:
from google.cloud import logging
File "/usr/local/lib/python3.6/site-packages/google/cloud/logging/__init__.py", line 21, in <module>
from google.cloud.logging.client import Client
File "/usr/local/lib/python3.6/site-packages/google/cloud/logging/client.py", line 32, in <module>
from google.cloud.client import ClientWithProject
ImportError: cannot import name 'ClientWithProject'
I have it running in a virtual environment
with this in requirements.txt:
google-cloud-logging>=0.20.0
I was able to get to the next error with:
pip3 install --upgrade google-cloud-logging
for Python 3 and:
pip install --upgrade google-cloud-logging
for Python 2.7
Try to update your google cloud components, run in terminal as admin:
gcloud components update
I had to install dataproc on top of the google-cloud-logging and google-cloud-storage.
Python3
pip3 install mrjob google-cloud-dataproc google-cloud-logging google-cloud-storage
Python2.7
pip3 install mrjob google-cloud-dataproc google-cloud-logging google-cloud-storage
I followed the instructions on tensorflow.org:
./conda create -n tensorflow python=2.7
source activate tensorflow
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl --ignore-installed
pip install --upgrade $TF_BINARY_URL
When I run python in terminal, I can import tensorflow
But when I try to import tensorflow in Spyder, I got:
ImportError: No module named tensorflow
How to get tensorflow in Spyder?
I just found out that if environment is changed at the Launcher from root to tensorflow, I can install a fresh copy of Spyder in that environment. Once installed, import tensorflow works.