not able to install dask on google colab - python

I use pip method to install on google lab. But I am not sure why it is not working.
Here is what I got
code
pip install "dask[dataframe]" --upgrade
error
Requirement already up-to-date: dask[dataframe] in /usr/local/lib/python3.7/dist-packages (2021.3.1)
Requirement already satisfied, skipping upgrade: partd>=0.3.10 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.1.0)
Requirement already satisfied, skipping upgrade: cloudpickle>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.3.0)
Requirement already satisfied, skipping upgrade: toolz>=0.8.2 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (0.11.1)
Requirement already satisfied, skipping upgrade: fsspec>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (0.8.7)
Requirement already satisfied, skipping upgrade: pyyaml in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (3.13)
Requirement already satisfied, skipping upgrade: numpy>=1.16; extra == "dataframe" in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.19.5)
Requirement already satisfied, skipping upgrade: pandas>=0.25.0; extra == "dataframe" in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.1.5)
Requirement already satisfied, skipping upgrade: locket in /usr/local/lib/python3.7/dist-packages (from partd>=0.3.10->dask[dataframe]) (0.2.1)
Requirement already satisfied, skipping upgrade: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from fsspec>=0.6.0->dask[dataframe]) (3.7.2)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (2.8.1)
Requirement already satisfied, skipping upgrade: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (2018.9)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->fsspec>=0.6.0->dask[dataframe]) (3.4.1)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->fsspec>=0.6.0->dask[dataframe]) (3.7.4.3)
Requirement already satisfied, skipping upgrade: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (1.15.0)
If I take the dataframe to use. Notification like this happens
code
import dask.dataframe as dd
error
ImportError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/dask/dataframe/__init__.py in <module>()
34 from .optimize import optimize
---> 35 from .multi import merge, concat, merge_asof
36 from . import rolling, backends
3 frames
ImportError: cannot import name 'keys_in_tasks' from 'dask.core' (/usr/local/lib/python3.7/dist-packages/dask/core.py)
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/dask/dataframe/__init__.py in <module>()
55 ' python -m pip install "dask[dataframe]" --upgrade # or python -m pip install'
56 )
---> 57 raise ImportError(msg) from e
ImportError: Dask dataframe requirements are not installed.
Please either conda or pip install as follows:
conda install dask # either conda install
python -m pip install "dask[dataframe]" --upgrade # or python -m pip install
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
I am using google colab to writing, why it is not available here? how could I fix it?

Try this.
!python -m pip install "dask[complete]"
import dask
import dask.dataframe as dd

Need to restart runtime after installing before importing.

Related

Could not find a version that satisfies the requirement statsmodels.api [ Python ]

When I try pip install statsmodels.api command,
I had these errors
ERROR: Could not find a version that satisfies the requirement statsmodels.api (from versions: none)
ERROR: No matching distribution found for statsmodels.api
Python version is Python 3.8.5
C:\Windows\system32>pip install statsmodels
Requirement already satisfied: statsmodels in c:\python38\lib\site-packages (0.12.0)
Requirement already satisfied: numpy>=1.15 in c:\python38\lib\site-packages (from statsmodels) (1.19.1)
Requirement already satisfied: patsy>=0.5 in c:\python38\lib\site-packages (from statsmodels) (0.5.1)
Requirement already satisfied: pandas>=0.21 in c:\python38\lib\site-packages (from statsmodels) (1.1.2)
Requirement already satisfied: scipy>=1.1 in c:\python38\lib\site-packages (from statsmodels) (1.5.2)
Requirement already satisfied: six in c:\python38\lib\site-packages (from patsy>=0.5->statsmodels) (1.15.0)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\python38\lib\site-packages (from pandas>=0.21->statsmodels) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\python38\lib\site-packages (from pandas>=0.21->statsmodels) (2020.1)
I think you want this:
pip install statsmodels
You're trying to install one submodule of a Python module/package. You have to install the whole package.
If you've already done this, then you already have the statsmodels.api module and don't have to install anything else.
I do not know how you have configured your environments (if you have many). but ensure that you install your package in the correct environment. However, please try the following for me:
conda install -c anaconda statsmodels

Google Cloud storage: ModuleNotFoundError

I am facing a classic "Module not found error". However, I cannot solved my problem with the questions already posted.
I am trying to use the google.cloud API in order to download some data from a public Google repository to a local linux server.
Below are the instructions I used in a Jupyter server:
# Upgrading pip
!/usr/bin/python3.8 -m pip install --upgrade pip
# Installing the Google cloud storage API
!pip3 install google
!pip3 install google-cloud-storage
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: google in /home/antoine/.local/lib/python3.8/site-packages (3.0.0)
Requirement already satisfied: beautifulsoup4 in /home/antoine/.local/lib/python3.8/site-packages (from google) (4.9.1)
Requirement already satisfied: soupsieve>1.2 in /home/antoine/.local/lib/python3.8/site-packages (from beautifulsoup4->google) (2.0.1)
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: google-cloud-storage in /home/antoine/.local/lib/python3.8/site-packages (1.30.0)
Requirement already satisfied: google-cloud-core<2.0dev,>=1.2.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-storage) (1.4.1)
Requirement already satisfied: google-resumable-media<2.0dev,>=0.6.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-storage) (0.7.1)
Requirement already satisfied: google-auth<2.0dev,>=1.11.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-storage) (1.20.1)
Requirement already satisfied: google-api-core<2.0.0dev,>=1.19.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (1.22.1)
Requirement already satisfied: google-crc32c<0.2dev,>=0.1.0; python_version >= "3.5" in /home/antoine/.local/lib/python3.8/site-packages (from google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (0.1.0)
Requirement already satisfied: six in /home/antoine/.local/lib/python3.8/site-packages (from google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (1.15.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (4.1.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (0.2.1)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.5" in /home/antoine/.local/lib/python3.8/site-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (4.6)
Requirement already satisfied: setuptools>=40.3.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (49.3.0)
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (2018.3)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/lib/python3/dist-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (2.18.4)
Requirement already satisfied: protobuf>=3.12.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (3.13.0)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (1.52.0)
Requirement already satisfied: cffi>=1.0.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-crc32c<0.2dev,>=0.1.0; python_version >= "3.5"->google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (1.14.1)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa<5,>=3.1.4; python_version >= "3.5"->google-auth<2.0dev,>=1.11.0->google-cloud-storage) (0.4.2)
Requirement already satisfied: pycparser in /home/antoine/.local/lib/python3.8/site-packages (from cffi>=1.0.0->google-crc32c<0.2dev,>=0.1.0; python_version >= "3.5"->google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (2.20)
from google.cloud import storage
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-48-d626caf5a463> in <module>
----> 1 from google.cloud import storage
2
3
4 def download_blob(bucket_name, source_blob_name, destination_file_name):
5 """Downloads a blob from the bucket."""
ModuleNotFoundError: No module named 'google'
Thank you for your advice!
Sometimes, when you have multiple versions of Python installed (with multiple Python 3.X versions), using pip3 is not enough, as it does not necessarily install a package for the latest version of Python installed on your machine.
You can check what version of python your pip3 is using by using the pip3 --version command.
If you plan to run a script with Python 3.8 and need to install a package for this specific version of Python, you can use:
pip3.8 install PACKAGE or
python3.8 -m pip install PACKAGE

module 'matplotlib' has no attribute '_get_configdir'

i am using python 3.7.1 and recently when im trying to run matlplotlib it isnt working. im getting this error:
AttributeError: module 'matplotlib' has no attribute '_get_configdir'
i tried using "matplotlib.use("Agg")" and i still get the same error.
i tried upgrading my matlpotlib version in anacond using this command
pip install --upgrade matplotlib and i get this error.
Collecting matplotlib
Using cached https://files.pythonhosted.org/packages/1a/c0/69e3f695d7384012e90be1e16570c08953baae00fd98094179ef87c7d5a2/matplotlib-3.1.1-cp37-cp37m-win_amd64.whl
Requirement already satisfied, skipping upgrade: numpy>=1.11 in c:\users\josh\conda\lib\site-packages (from matplotlib) (1.16.3)
Requirement already satisfied, skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\josh\conda\lib\site-packages (from matplotlib) (2.3.0)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.1 in c:\users\josh\conda\lib\site-packages (from matplotlib) (2.7.5)
Requirement already satisfied, skipping upgrade: cycler>=0.10 in c:\users\josh\conda\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied, skipping upgrade: kiwisolver>=1.0.1 in c:\user\josh\conda\lib\site-packages (from matplotlib) (1.0.1)
Requirement already satisfied, skipping upgrade: six>=1.5 in c:\users\josh\conda\lib\site-packages (from python-dateutil>=2.1->matplotlib) (1.12.0)
Requirement already satisfied, skipping upgrade: setuptools in c:\users\josh\conda\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (40.6.3)
chances 0.1.6 has requirement matplotlib==2.2.3, but you'll have matplotlib 3.1.1 which is incompatible.
Installing collected packages: matplotlib
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\josh\\conda\\Lib\\site-packages\\matplotlib\\ft2font.cp37-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
can anyone guide me in this?
i dont know what to do. thank you.

“ImportError: No module named boto3” on mac

I am trying a deployment script, which will need to import boto3, when I run the script, it give me error message:
ImportError: No module named boto3
then I ran:
pip install boto3
it returns:
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.9.228)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.9.4)
Requirement already satisfied: s3transfer<0.3.0,>=0.2.0 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.2.1)
Requirement already satisfied: botocore<1.13.0,>=1.12.228 in /usr/local/lib/python3.7/site-packages (from boto3) (1.12.228)
Requirement already satisfied: docutils<0.16,>=0.10 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (0.14)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in /usr/local/lib/python3.7/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (2.8.0)
Requirement already satisfied: urllib3<1.26,>=1.20; python_version >= "3.4" in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (1.25.3)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.228->boto3) (1.12.0)
I ran pip3 install boto3, still it gave the same output as above.
then I ran the deployment script, the same errors with complaining
ImportError: No module named boto3
Any ideas where goes wrong?
I'm using mac 10.14.6 version.
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.9.228)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.9.4)
Make sure that /usr/local/lib/python3.7/site-packages and /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages are in the path.
Use the below code to temporarily append it to the path.:
import sys
print(sys.path)
sys.path.append('/usr/local/lib/python3.7/site-packages')
sys.path.append('/Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages')
print(sys.path)
import boto3
Make sure you have installed your package with the pip associated with a particular python, use:
python -m pip install <pkg>
instead of:
pip install <pkg>

Mac OS High Sierra: Tensorflow verions returned by `pip3 upgrade ` and `python3 -c 'import tensorflow as tf; print(tf.__version__)'` differ

I am currently getting the error, TypeError: softmax() got an unexpected keyword argument 'axis'.
It seems this error is common if you don't have up-to-date keras/tensorflow.
I checked what version of tensorflow I have with python3 -c 'import tensorflow as tf; print(tf.__version__)' It returned 0.12.0 which indeed looks out of date.
However, when I try to upgrade tensorflow, with pip3 install tensorflow --upgrade I get
Requirement already up-to-date: tensorflow in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(0.12.0) Requirement already satisfied, skipping upgrade:
numpy>=1.11.0 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages(from
tensorflow) (1.15.3) Requirement already satisfied, skipping upgrade:
protobuf==3.1.0 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from tensorflow) (3.1.0) Requirement already satisfied, skipping
upgrade: six>=1.10.0 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from tensorflow) (1.11.0) Requirement already satisfied, skipping
upgrade: wheel>=0.26 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from tensorflow) (0.32.2) Requirement already satisfied, skipping
upgrade: setuptools in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from protobuf==3.1.0->tensorflow) (39.0.1)
I tried to force the update with pip3 install --ignore-installed --upgrade tensorflow but got:
Collecting tensorflow Could not find a version that satisfies the
requirement tensorflow (from versions: ) No matching distribution
found for tensorflow
When I tried to upgrade with python3 -m pip install tensorflow --upgrade:
Requirement already up-to-date: tensorflow in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.12.0)
Requirement already satisfied, skipping upgrade: wheel>=0.26 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (0.32.2)
Requirement already satisfied, skipping upgrade: protobuf==3.1.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (3.1.0)
Requirement already satisfied, skipping upgrade: numpy>=1.11.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages(from tensorflow) (1.15.3)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (1.11.0)
Requirement already satisfied, skipping upgrade: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from protobuf==3.1.0->tensorflow) (39.0.1)
When I print sys.path in my program, I get:
['/Users/myname/topdirect', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages']
pip3 show tensorflow I get:
Name: tensorflow
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource#google.com
License: Apache 2.0
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: six, protobuf, numpy, wheel
Required-by:
First of all, I would recommend using anaconda environment to manage your tensorflow version. On the other side, you need to add your operating system to make the question more clear.

Categories