Initially, I ran experiments on python3, which supports Pandas perfectly. Since our lab recently upgraded the server to an RTX 3000 series GPU, it supports Python 3.9, not previous versions. For that, when I ran the tests in python3.9 (python3.9 code file.py), the following error occurred:
ModuleNotFoundError: No module named 'pandas'
Then I ran 'pip install pandas' and found that the requirements had already been met; here's further information:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pandas in ./.local/lib/python3.6/site-packages (1.1.5)
Requirement already satisfied: pytz>=2017.2 in ./.local/lib/python3.6/site-packages (from pandas) (2021.1)
Requirement already satisfied: python-dateutil>=2.7.3 in ./.local/lib/python3.6/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.15.4 in ./.local/lib/python3.6/site-packages (from pandas) (1.19.5)
Requirement already satisfied: six>=1.5 in ./.local/lib/python3.6/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
But when I ran the file again, I received the same issue: ModuleNotFoundError: No module named 'pandas'
How can we install solve this issue?
You need to make sure you are running pip with the correct python version. ./.local/lib/python3.6/site-packages in your error indicates that you are still using python3.6.
If you are using IPython, you can type pip install pandas directly in the interactive mode (not in the terminal), which uses the proper Python version then.
In general, I would create a virtual environment using /path/to/python39 -m venv ~/myvenv, then active it using source ~/myvenv/bin/activate and install packages then - especially if using a graphics card you may need different package versions for different projects.
According to my understanding, our lab server supports various Python versions, and I was executing my code files from a directory with a Python version of 3.6, which caused the issue. Therefore, we must either change our project directory to Python 3.9 and install Pandas there or use the following command as instructed here.
python3.9 -m pip install pandas
Related
When going through the process of installing OpenVino as documented here, I'm running:
sudo ./install_prerequisites.sh
and getting
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.4.1 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.8.0rc0)
ERROR: No matching distribution found for tensorflow~=2.4.1
As suggested in the documentation, you can configure frameworks individually if there are errors. However, even using pip it doesn't seem there is a matching distribution for Tensorflow 2.4.1:
pip install tensorflow==2.4.1
ERROR: No matching distribution found for tensorflow==2.4.1
How can you get Tensorflow 2.4.1 installed?
I've already shown you how to debug such problems. Well, let's see.
The list of available packages for tensorflow 2.4.1 includes wheels for Python 3.6-3.8. No 3.9 and no source code. Wheels for Python 3.9 are available starting from tensorflow 2.5.0rc0 — exactly like is said in the error message.
What can you do? 1) Downgrade once more, to Python 3.8. Or 2) Use more recent OpenVino source code; the current sources at GitHub list tensorflow~=2.5 as a dependency. Or 3) Find in your downloaded sources files requirements*.txt and replace version tensorflow~=2.4.1 with 2.5.0.
I am a beginner in machine learning. I am using colab as the primary development platform.
I would like to use the latest version of sklearn in my coding projects. However, colab's sklearn version is 0.22.
Can I update the scikit learn version in colab?
Thank you.
You mentioned that you have a 0.22 version, hopefully, you checked and received the following results (by default) in your colab notebook.
!pip list | grep scikit-learn
scikit-learn 0.22.2.post1
I presume that you already tried with the following command, which ideally installs the latest version of sckit-learn.
!pip install scikit-learn
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (0.22.2.post1)
Requirement already satisfied: numpy>=1.11.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn) (1.19.5)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn) (1.0.1)
Requirement already satisfied: scipy>=0.17.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn) (1.4.1)
As per the latest scikit-learn document, 0.24.2 is the latest version, which you can install/upgrade by overriding the version number as shown in the following script. It should help you if you want to upgrade to 0.24.2.
!pip install scikit-learn==0.24.2
Then, verify the scikit-learn version by following script.
!pip list | grep scikit-learn
scikit-learn 0.24.2
Also, alternative way to upgrade the package in a colab environment.
!pip install scikit-learn --upgrade
Ideally, you'll need to install it each time, however, some workaround such as you can save the current configuration into your google drive. Refer to the following script which was suggested in another post.
from google.colab import drive
drive.mount('/content/gdrive')
pip freeze --local > /content/gdrive/My\ Drive/colab_installed.txt
Refer to the following script to restore the environment from the file.
from google.colab import drive
drive.mount('/content/gdrive')
pip install --upgrade --force-reinstall `cat /content/gdrive/My\ Drive/colab_installed.txt`
I have an installation script for ERPNext that works just fine on Ubuntu 18.04.
When I run the same script on 20.04 I am obliged to wait more than 20 minutes for it to complete where it takes around 30 secs on 18.04.
My script includes these two lines:
./env/bin/pip install numpy==1.18.5
./env/bin/pip install pandas==0.24.2
Their output is:
Collecting numpy==1.18.5
Downloading numpy-1.18.5-cp38-cp38-manylinux1_x86_64.whl (20.6 MB)
|████████████████████████████████| 20.6 MB 138 kB/s
Installing collected packages: numpy
Successfully installed numpy-1.18.5
Collecting pandas==0.24.2
Downloading pandas-0.24.2.tar.gz (11.8 MB)
|████████████████████████████████| 11.8 MB 18.0 MB/s
Requirement already satisfied: python-dateutil>=2.5.0 in ./env/lib/python3.8/site-packages (from pandas==0.24.2) (2.8.1)
Requirement already satisfied: pytz>=2011k in ./env/lib/python3.8/site-packages (from pandas==0.24.2) (2019.3)
Requirement already satisfied: numpy>=1.12.0 in ./env/lib/python3.8/site-packages (from pandas==0.24.2) (1.18.5)
Requirement already satisfied: six>=1.5 in ./env/lib/python3.8/site-packages (from python-dateutil>=2.5.0->pandas==0.24.2) (1.13.0)
Building wheels for collected packages: pandas
Building wheel for pandas (setup.py) ... done
Created wheel for pandas: filename=pandas-0.24.2-cp38-cp38-linux_x86_64.whl size=43655329 sha256=0067caf3a351f263bec1f4aaa3e11c5857d0434db7f56bec7135f3c3f16c8c2b
Stored in directory: /home/erpdev/.cache/pip/wheels/3d/17/1e/85f3aefe44d39a0b4055971ba075fa082be49dcb831db4e4ae
Successfully built pandas
Installing collected packages: pandas
Successfully installed pandas-0.24.2
The line "Building wheel for pandas (setup.py) ... /" is where the 20 min delay occurs.
This is all run from within the Frappe/ERPnext command directory, which has an embedded copy of pip3, like this:
erpdev#erpserver:~$ cd ~/frappe-bench/
erpdev#erpserver:~/frappe-bench$ ./env/bin/pip --version
pip 20.1.1 from /home/erpdev/frappe-bench/env/lib/python3.8/site-packages/pip (python 3.8)
erpdev#erpserver:~/frappe-bench$
I would be most grateful for any suggestions how to speed it up.
I just update pip using pip install --upgrade pip and it solved.
Your issue may be less to do with your distribution and more to be with the Python version in your virtualenv. Ubuntu 20.04 has its default Python pointing to 3.8.
From the pandas project listing on PyPI, your pip searches for a version that's compatible with your system, as provided by the project maintainers.
It seems you're using CPython3.8. pandas==0.24.2 does not wheels built for your version, so your system builds them for itself each time. You can check the available download files from here.
Possible Solutions:
While creating your env, check out this answer to generate a virtual environment for a different version. Seems like your options are between 3.5, 3.6 and 3.7.
Build a wheel for CPython3.8 and ship it along with your script. You can install your package from using that.
When I try and install tfcoreml (package to conver tensorflow files to coreml) it gives me this error:
I have tried installing the coremltools seperatly in a python virtual enviroment...still doesn't work.
Rorys-MBP:~ roryhodgson$ cd tf-coreml
Rorys-MBP:tf-coreml roryhodgson$ pip install -e .
Obtaining file:///Users/roryhodgson/tf-coreml
Requirement already satisfied: numpy>=1.6.2 in /Users/roryhodgson/anaconda3/lib/python3.7/site-packages (from tfcoreml==0.3.0) (1.15.4)
Requirement already satisfied: protobuf>=3.1.0 in /Users/roryhodgson/anaconda3/lib/python3.7/site-packages (from tfcoreml==0.3.0) (3.7.0)
Requirement already satisfied: six>=1.10.0 in /Users/roryhodgson/anaconda3/lib/python3.7/site-packages (from tfcoreml==0.3.0) (1.12.0)
Requirement already satisfied: tensorflow>=1.5.0 in /Users/roryhodgson/anaconda3/lib/python3.7/site-packages (from tfcoreml==0.3.0) (1.13.1)
Collecting coremltools>=0.8 (from tfcoreml==0.3.0)
ERROR: Could not find a version that satisfies the requirement coremltools>=0.8 (from tfcoreml==0.3.0) (from versions: none)
ERROR: No matching distribution found for coremltools>=0.8 (from tfcoreml==0.3.0)
At this point it appears you need to use Python 3.6 with coremltools. It's not working with Python 3.7 yet.
To solve this issue, it's easiest if you install Anaconda (the latest version, which is for Python 3.7) and then create a new virtual environment that uses Python 3.6. Now you can install coremltools / tfcoreml into this virtual environment.
I am trying to import the pandas module. However, when attempting to run my code, I get the following error:
raise ImportError('dateutil 2.5.0 is the minimum required version')
ImportError: dateutil 2.5.0 is the minimum required version
However, I already have the 2.5.0 verison on my computer, as seen from the following message when attempting to pip install.
Requirement already satisfied: python-dateutil in /Users/nat/Library/Python/3.5/lib/python/site-packages (2.5.0)
Does anyone have any suggestions on what could be the problem?
Try installing below package,
pip install python-dateutil==2.5.0