Unable to import pygrib on python3 (Mac) - python-3.x

I've installed pygrib by using conda install -c conda-forge pygrib and no issues were raised. However, when importing it in order to use it I get this message:
ImportError: dlopen(/Users/andrea1994/anaconda3/lib/python3.6/site-packages/pygrib.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libpng16.16.dylib
Referenced from: /Users/andrea1994/anaconda3/lib/python3.6/site-packages/pygrib.cpython-36m-darwin.so
Reason: Incompatible library version: pygrib.cpython-36m-darwin.so requires version 51.0.0 or later, but libpng16.16.dylib provides version 49.0.0
I've gone through several procedures that were thought to solve similar issues but none worked (updating libpng, uninstalling and installing back Anaconda,...). Does anyone have any clue? I'm not an expert in this field: most of the times I manage to get things working, but as you see sometimes I fail. Thank you!

I know this is old, but I had the same issue and finally was able to import pygrib after I started a clean environment, installed from conda
conda install -c conda-forge pygrib and then installed jasper, even though I believe it is installed with the pygrib install I am not sure if the correct one is installed or what.
conda install jasper -c conda-forge

sudo python -m pip install pygrib

Related

Python3: No module named dateutil

I am unable to get dateutil installed in my Python code.
from dateutil import tz
ImportError: No module named dateutil
I had date-util installed (Python version is 3.7.3)
> pip3 install python-dateutil
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (2.7.3)
I cannot uninstall them (to reinstall). I get the following error
> sudo pip3 uninstall python-dateutil
Not uninstalling python-dateutil at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'python-dateutil'. No files were found to uninstall.
Then, I used the following command to uninstall:
> sudo apt-get remove python3-dateutil #This worked
> pip3 install python-dateutil
This works, but asks me to install cycler, kiwisolver, pyparsing, which I install using pip3. But I still cant get the python code working - has the same error (ImportError: No module named dateutil)
Any suggestions on what's going on?
I found a solution - The python code is being called from a bash script. It worked fine until recently. Recently I installed some other packages that installed python 2.x. So, the python scripts were using Python 2.x rather than 3.x. I had symbolic links to python 3.x, but that didn't help.
Now, I am explicitly use python3 mycode.py to overcome this issue.
I highly recommend to use conda environment instead of pip. See, there are several modules which do not give expected behaviour in pip (like pytorch).
Get the package installed using:
conda install -c conda-forge python-dateutil
returning the question, to get the package running it requires fulfillment of it's dependencies. If you are using python 3.7.3 its obvious that it may lack in some of the features of modern python 3.11 as a result you get the obvious error. The python package python-dateutil must have been configured according to the modern python language version.
Iam using python 3.11.1 and the package gets installed very perfectly. You may install old version of package or upgrade your python language version or use Conda as mentioned before.

Could not build wheels for fbprophet which do not use PEP 517

I am trying to install Facebook's Prophet package on my windows system using pip install fbprophet command. However, I am getting an error:
DEPRECATION: Could not build wheels for fbprophet which do not use PEP 517.
I am using pip version 20.2.2, Python 3.6.8 and all other requirements are satisfied.
I tried searching the issue with PEP 517, but couldn't find one. It seems that fbprophet package do not use PIP 517. I couldn't find a way to disable it or an alternative to install the package.
I also tried using conda install -c conda-forge fbprophet, but no luck.
Please let me know what is the issue and how can I resolve it.
Thanking you in anticipation.
You've probably resolved this by now or moved on but I was having a similar issue. On Windows I was able to install prophet by first running:
conda install -c conda-forge compilers
to install the appropriate compilers. Then run:
conda install -c conda-forge prophet
On MacOS I found I needed to install ruby version manager (RVM) to be able to install prophet

How to fix EnvironmentError when installing modules using pip?

When trying to install requests or literally anything using pip it'll collect the option and then give me this ERROR every time. I can't use pip to install anything.
C:\Users\evand>pip3 install requests
Collecting requests
ERROR: Could not install packages due to an EnvironmentError: Could not find a suitable TLS CA certificate bundle, invalid path: path/to/ca-bundle.crt
Version of pip:
C:\Users\evand>pip --version
pip 19.2.3 from c:\users\evand\appdata\local\programs\python\python38-32\lib\site-packages\pip (python 3.8)
Version of Python:
C:\Users\evand>py --version
Python 3.8.3
Current Environment Variables (If this is related at all)
I have also tried the 'Repair' option using the Python Installer as well as uninstalling then reinstalling as a custom installation with 'Add to PATH' and the other options. That didn't fix the issue, so I deleted pip along with every module installed on my computer then reinstalled pip. Nada. At this point, I can no longer program with this computer because I cannot import any module in any of my scripts. I am not sure why this issue suddenly arose. Help would be very much appreciated.
This worked for me:
Uninstalling the pip configuration file in %appdata%/pip/ then 'modifying' python using the python launcher.

How to install tensorflow 1.15.0 in Ubuntu server 18.04

I am using Azure to create an Ubuntu server 18.04. The python3 default version in this VM is 3.6.9. I tried to install python3-pip, then install Tensorflow version 1.15.0 by command: sudo pip3 install Tensorflow==1.15.0.
However I got this error: No matching distribution found for tensorflow==1.15.0
I really don't know how to fix it. On my Windows PC, I got the same error while using python3.7, then I change to use python3.6.5 and everythings is fine. So that I think maybe I should try to install python 3.6.5 on Ubuntu VM. But again, this time, I can't install correctly python 3.6.5 on my Ubuntu server.
Can you please help me to fix it. I am just a newbie and honestly, I am not really good with Ubuntu.
Thank you so much.
I had the same issue.
A simple upgrade of pip to the latest version by:
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
solved the problem for me. Checkout https://askubuntu.com/questions/712339/how-to-upgrade-pip-to-latest for details how to upgrade pip.
After checking it seems the pip3 version shipped with Ubuntu defaults to pip 9.0.1. However, this version seems to supports only up to Tensorflow 1.14.
I would also strongly suggest to use virtual environments like Anaconda in order not to mess up your system python.
E.g.: https://docs.anaconda.com/anaconda/install/linux/
These are the list of files for TensorFlow 1.15
This command would work:
pip3 install tensorflow==1.15.0
I do see the manylinux wheel file for Ubuntu.
What CPU model and pip version are you using?
Debugging:
pip3 -v install tensorflow==1.15.0 | grep Found | more
Can help you see which platform and tags pip3 is trying to find in wheel files.
In the past I also have seen issue with pip default version (9.0.1), make sure you are running a recent version (e.g. pip-20.0.2):
apt install python3-pip && pip3 install --upgrade pip

Version of libjpeg while using other package

I would like to visualize weather data, which are under the format .grb2. Therefore I need the library pygrib for python. I've already install grib-api and pygrib, as explained on the installation notes of pygrib (http://jswhit.github.io/pygrib/docs/). I'm using python 3.5 installed with anaconda. I ran
brew install grib-api
pip install pygrib
However when I try to import pygrib in a python script I always get the same error message :
import pygrib
--> ImportError: dlopen(/Users/Marguerite/anaconda/lib/python3.5/sitepackages/pygrib.cpyton-35m-darwin.so, 2): Library not loaded: #rpath/libjpeg.9.dylib
Referenced from: /Users/Marguerite/anaconda/lib//libgrib_api.dylib
Reason: Incompatible library version: libgrib_api.dylib requires version 12.0.0 or later, but libjpeg.9.dylib provides version 11.0.0
I've tried several times to uninstall/reinstall jpeg libraries, or install libjpeg with macports, nothing seems to do the trick ... Also I can't find the library libjpeg when I run "conda list". It seems it is included into some other library (jpeg of libjpeg-turbo), but again updating those libraries didn't improve results.
I would appreciate really any help or thoughts !
Thanks,
Marguerite
Actually I found a solution. Libjpeg is updated with conda update jpeg, but not to the latest version.
The trick that worked for me is to install a bigger package, which automatically update libjpeg. Just run :
conda install -c conda-forge jasper
After that it worked fine for me :)

Resources