TFCOREML install erorr - tensorflow

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.

Related

Pandas installation in python 3.10, but turning IDLE on , showing ModuleNotFoundError: No module named 'pandas'

I just installed pandas through windows cmd.exe, and it shows like this. I guess I installed it successfully, but it still shows ModuleNotFoundError: No module named 'pandas'. How can I fix this? Thank you.
Requirement already satisfied: pandas in c:\users\shuyao yu\appdata\local\programs\python\python311\lib\site-packages (1.5.1)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\shuyao yu\appdata\local\programs\python\python311\lib\site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\shuyao yu\appdata\local\programs\python\python311\lib\site-packages (from pandas) (2022.6)
Requirement already satisfied: numpy>=1.21.0 in c:\users\shuyao yu\appdata\local\programs\python\python311\lib\site-packages (from pandas) (1.23.4)
Requirement already satisfied: six>=1.5 in c:\users\shuyao yu\appdata\local\programs\python\python311\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
I tried to type 'pip install pandas', 'python3 -m pip install pandas', the cmd result looks same, but still in IDLE it shows ModuleNotFoundError: No module named 'pandas'

No module named horovod

I have already used
pip install horovod in cmd but the package failed to install.
How to deal with it guys. Please Help.
Using cached horovod-0.25.0.tar.gz (3.4 MB)
Requirement already satisfied: cloudpickle in c:\users\hp\anaconda3\lib\site-packages (from horovod) (2.0.0)
Requirement already satisfied: psutil in c:\users\hp\anaconda3\lib\site-packages (from horovod) (5.8.0)
Requirement already satisfied: pyyaml in c:\users\hp\anaconda3\lib\site-packages (from horovod) (6.0)
Requirement already satisfied: cffi>=1.4.0 in c:\users\hp\anaconda3\lib\site-packages (from horovod) (1.15.0)
Requirement already satisfied: pycparser in c:\users\hp\anaconda3\lib\site-packages (from cffi>=1.4.0->horovod) (2.21)
Building wheels for collected packages: horovod
Building wheel for horovod (setup.py) ... error
ERROR: Command errored out with exit status 1:

ModuleNotFoundError: No module named 'pandas' (Problem with Python3.9)

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

I upgraded pyOpenSSL but it is still 0.13.1 version. Unable to upgrade to 18.0.0

I am trying to get pyOpenSSL 18.0.0 but it doesn't work. Here are my commands:
sudo pip install pyOpenSSL==18.0.0
I get this:
The directory '/Users/mac/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/mac/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pyOpenSSL==18.0.0 in ./Library/Python/2.7/lib/python/site-packages (18.0.0)
Requirement already satisfied: six>=1.5.2 in /Library/Python/2.7/site-packages (from pyOpenSSL==18.0.0) (1.11.0)
Requirement already satisfied: cryptography>=2.2.1 in ./Library/Python/2.7/lib/python/site-packages (from pyOpenSSL==18.0.0) (2.4.2)
Requirement already satisfied: idna>=2.1 in /Library/Python/2.7/site-packages (from cryptography>=2.2.1->pyOpenSSL==18.0.0) (2.7)
Requirement already satisfied: enum34; python_version < "3" in ./Library/Python/2.7/lib/python/site-packages (from cryptography>=2.2.1->pyOpenSSL==18.0.0) (1.1.6)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in ./Library/Python/2.7/lib/python/site-packages (from cryptography>=2.2.1->pyOpenSSL==18.0.0) (1.11.5)
Requirement already satisfied: asn1crypto>=0.21.0 in ./Library/Python/2.7/lib/python/site-packages (from cryptography>=2.2.1->pyOpenSSL==18.0.0) (0.24.0)
Requirement already satisfied: ipaddress; python_version < "3" in ./Library/Python/2.7/lib/python/site-packages (from cryptography>=2.2.1->pyOpenSSL==18.0.0) (1.0.22)
Requirement already satisfied: pycparser in ./Library/Python/2.7/lib/python/site-packages (from cffi!=1.11.3,>=1.7->cryptography>=2.2.1->pyOpenSSL==18.0.0) (2.19)
Looks like pyOpenSSL is already installed. But then I check:
pip list
And I get:
pyOpenSSL 0.13.1
The sudo command might be making pip install that version of pyopenssl to the site-packages of the root user. Simply running pip install pyOpenSSL==18.0.0 (outside of a virtual environment) should install it in the site-packages of the current user.
As an aside, you should consider using virtual environments for better dependency management of your python project. For that, please reference {this answer}.

Make colab use the latest installation of a library

I am trying to use the bleeding edge version of sklearn installing it from their github as shown on line 2 in the below image. Line 5 imports some functions from this version of sklearn. This line works in my local and not on Google Colab. Am I missing something to hint the tool to use the latest installed version and not its cached version?
I am not sure why that's happening but if you uninstall scikit-learn before installing the latest dev, it would work:
[1] !pip uninstall scikit-learn -y
Uninstalling scikit-learn-0.19.1:
Successfully uninstalled scikit-learn-0.19.1
[2]!pip install Cython
!pip install git+git://github.com/scikit-learn/scikit-learn.git
Requirement already satisfied: Cython in /usr/local/lib/python3.6/dist-packages (0.28.2)
Collecting git+git://github.com/scikit-learn/scikit-learn.git
Cloning git://github.com/scikit-learn/scikit-learn.git to /tmp/pip-req-build-d59ukisw
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (1.14.3)
Requirement already satisfied: scipy>=0.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (0.19.1)
Building wheels for collected packages: scikit-learn
Running setup.py bdist_wheel for scikit-learn ... done
Stored in directory: /tmp/pip-ephem-wheel-cache-is88dk15/wheels/a1/50/0e/316ef2ff8d4cfade292bd20b49efda94727688a153382745a6
Successfully built scikit-learn
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.20.dev0
[3] !pip freeze | grep scikit
scikit-image==0.13.1
scikit-learn==0.20.dev0
[4] from sklearn.preprocessing import CategoricalEncoder
[5] import sklearn
sklearn.__version__
'0.20.dev0'