Issues running Matplotlib/PyQt- Error - python

I am having problems with my matplotlib/Pyqt. I have tried several different things like uninstalling matplotlib using conda remove and pip uninstall and then tried re-installing. When I try re-installing matplotlib through conda reinstall, I get the following error:
IOError: [Errno 2] No such file or directory: u'C:\Anaconda2\pkgs\pandas-0.19.2-np111py27_1\info\index.json'
I seem to be able to install matplotlib via pip install, but when I try running my code in jupyter notbook I get the following error:
ImportError: No module named PyQt4.
Any suggestions? I am using Python version 2.7.13 and Anaconda version 4.0.0 (64-bit) windows operator.

For Anaconda try this :
conda clean --packages --tarballs
conda update qt
or just Re-install it.
Finally, Don't forget to install PyQt4:
pip install PyQt4
or download the python Wheel pkg from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4
& install it by:
pip install PyQt4-4.11.4-cp35-none-win_amd64.whl

Related

How to fix 'DLL load failed while importing win32api' in Jupyter notebook after connecting VS code to Jupyter notebook?

When I try using Jupyter notebook, kernel error appears like this
import win32api
ImportError: DLL load failed while importing win32api:
After connecting vs code to jupyter notebook, error appears.
I've already tried
conda install pywin32
and copied the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 to C:\Windows\System32
but it didn't work.
how to fix?
Try installing it using pip, it can solve your problem here
pip install --upgrade pywin32==225
Or this, if you don't have the package already
pip install pywin32==225
After activating the env where the above is causing issue uninstall win32api (if it is installed):
pip uninstall pywin32
Then use pip to install pywin32:
pip install pywin32
Jupyter should work afterward. The solution is proposed here by ValentinVerschinin
Are you using Python 3.8? It seems to be a Python 3.8 specific problem.
Can you try to install the pywin32==225?
You can refer to this page.
Installing the relevant binary from github worked for me

ImportError: DLL load failed while importing pdftotext: The specified module could not be found

I installed installed pdftotext module as
conda install -c conda-forge poppler
pip install pdftotext (I also tried pip install pdftotext==2.1.5), but it still triggers an error when I try to import it, abeit being installed successfully:
import pdftotext
ERROR:
ImportError: DLL load failed while importing pdftotext: The specified module could not be found.
IDK what else to do; so, your help will be really appreciated:)
I ran into the same problem and noticed that pdftotext wasn't listed in conda list. As it turned out, simply running pip install pdftotext inside a new environment installs pdftotext as a system-wide package, but not as a specific package for your current conda enviroment.
I fixed this problem by installing pip into my conda environment using the following command:
conda install pip
After that, I ran pip install pdftotext==2.1.4 (as the 2.1.5 version didn't work for me).
Lastly, I checked conda list to verify the installation.
Personally I have had the same question. I have solved it by
conda update conda .
Then I redo the same procedure
conda install -c conda-forge poppler
pip install pdftotext
After this 3 steps I import successfully pdftotext. I hope it also works for you.

Why can't I import graphviz

I have installed graphviz by trying pip install graphviz. It said it had been successfully installed but I still got the ImportError: No module named graphviz. BTW, I'm not running the program on Conda or Anaconda.
I had the same issue. The problem for me was the default python version that I was using for pip. I fixed it using python3 -m pip install desired_package.
Hope it solves your problem

Can't pip install GDAL for python 3.6 on mac os

I can pip install GDAL for the python2.7 on my mac just fine using pip. However when I try to install the package for my python3.6 using
pip3 install gdal I get a long error message that ends with this:
warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
extensions/gdal_wrap.cpp:3168:10: fatal error: 'cpl_port.h' file not found
#include "cpl_port.h"
^~~~~~~~~~~~
1 warning and 1 error generated.
error: command 'clang' failed with exit status 1
I tried re-installing GDAL using homebrew as suggested here, Unable to install GDAL in python 3 using pip (clang failed with exit status 1), but no luck. Looking for any suggestions.
I have tried a lot to install GDAL package using PIP and ended up in either missing some modules or encountered errors. So, best solution for installing GDAL is to setup condo environment and install gdal which will work :
conda create --name yourenvnamehere python=python3.7
conda activate yourenvnamehere
conda install -c anaconda numpy
conda install -c conda-forge gdal
if you have followed the above code:
import gdal
should work. Happy coding with spatial data:)
Do you have anaconda python installed?¿ Inside anaconda navigator you create an environment for python 2.7 or python 3.6, in this case you want 3.6 so create it. And then inside this env you can search for the lib and install it.
if it doesn't work try getting in your terminal (anaconda promp) you get inside your environment doing:
activate Anaconda3_64
(Anaconda3_64 is the name of the environment you defined inside anaconda navigator) and try pip install there.
pip install gdal
it worked for me but i have Windows so hope its the same in mac.

Can't install tensorflow with conda package manager. Pip3 not found and virtualenv not compatible

Trying to install tensorflow on OSX with python installed with anaconda :
https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html#virtualenv-installation
Get stuck on :
sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp35-none-any.whl
and get error :
tensorflow-0.7.1-cp35-none-any.whl is not a supported wheel on this platform.
When I try virtualenv installation
New python executable in /Users/xxx/tensorflow/bin/python
ERROR: The executable /Users/xxx/tensorflow/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/xxx/tmp' (should be '/Users/xxx/tensorflow')
ERROR: virtualenv is not compatible with this system or executable
What's the best way to install tensorflow with python installed with anaconda?
I had the same issue trying to install with python 3.4.3 and pip 8.1.
$ pip install --upgrade https://storage.googleapis.com/tensorflow
tensorflow-0.7.1-cp35-none-any.whl is not a supported wheel on this platform.
To fix I simply upgraded to python 3.5.1 (I use pyenv to allow installation local of multiple versions of python).
Running with python 3.5.1 I can now successfully execute:
$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp35-none-any.whl
...happy install message fun follows....
I have no clue as to why python 3.4.3 fails, but this version of tensorflow https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0rc0-py3-none-any.whl seems to work with python 3.4.3 fine.

Categories