I installed ggplot for python 2.7 in a Win64 env using conda via the command line:
$conda install -c https://conda.binstar.org/bokeh ggplot
since:
$pip install -U ggplot
could not locate the package (see pevious stackQ).
Checking if module is installed:
>python -c "import ggplot"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ggplot
Any idea how to resolve this?
Update notes: debug tests
$pip freeze
>(finds package ggplot)
$import imp
$imp.find_module("ggplot")
>'C:\\Users\\Remi\\Anaconda2\\envs\\envx\\lib\\site-packages\\ggplot'
I am posting the resolution I arrived to. It is not linear, although it may benefit others who may encounter a similar issue.
First step: activated the environment envx where the ggplot module was said to reside in.
Importing module again:
$python -c "import ggplot"
Throws a complaint ending with:
ImportError: DLL load failed: The specified module could not be found.
among failures in requesting imports from scipy and ggplot modules.
Second step: re-installed scipy
$conda install scipy
Here conda has to do some 'intuitive' updates of python, numpy ... ect. During the initial ggplot install, conda went the downgrade route.
That's it.
Related
When I do python -m pip install 'uwsgi==2.0.*'
I'm getting:
/usr/bin/python: No module named pip
which pip gives:
/home/snowcrash/.local/bin/pip
If I do pip I get:
pip
Traceback (most recent call last):
File "/home/snowcrash/.local/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
ImportError: No module named pip._internal.cli.main
This does not seem to help /usr/local/bin/python: No module named pip
I don't know your exact situation, but this suggestions can be helpful:
To fix the No module named pip._internal.cli.main error
It seems like you have a broken pip. I mean, incomplete (and incompatible) parts of pip living in the same Python distribution, that generates... a useless pip. That's why you hit with those weird errors.
Something you can do is re-installing pip (from scratch). Consider tools like get-pip.py or python -m ensurepip. See the reference of this problem at this GitHub issue.
To fix the error with python -m pip
Also, you may have Python 2 installed in addition of Python 3. To verify that, run python --version. If you get a Python 2 version, try python3 --version. If you don't get errors (and receive a Python 3 version), replace python -m pip with python3 -m pip. That should fix your No module named pip issue. Also, you can run python3 -m ensurepip (or python -m ensurepip, if python3 doesn't exist).
However, if that doesn't work, maybe you will have to re-install the whole Python.
I have a python module that tries to import from passlib.hash import pbkdf2_sha256, however when running the module, I get the ModuleNotFoundError.
I have tried running the module in my base environment, a venv, in a poetry shell, and I've tried reinstalling passlib through poetry install, pip install, pip install --force-reinstall, and none of it gets the module to see passlib being installed. I'm at a complete loss as to why this library just won't work.
The full error message is:
poetry run src/api-keychain/main.py --help
Traceback (most recent call last):
File "XXX/src/api-keychain/main.py", line 5, in <module>
from crypto import encrypt_key, decrypt_key
File "XXX/src/api-keychain/crypto.py", line 5, in <module>
from passlib.hash import pbkdf2_sha256
ModuleNotFoundError: No module named 'passlib'
Since you mentioned about you successful installed passlib, I guess you might not install it with the python interpreter you are using.
First Try:
pip install passlib
If not work, it could because you have both Python2 and 3 try:
pip3 install passlib
python3 -m pip install passlib
And if you have an IDE like Pycharm, you can use it to check what packages are with the interpreter you are using via go to the Interpreter Settings.
I have installed python 3.7 and want to do some forecasting using fbprophet (https://facebook.github.io/prophet/docs/installation.html#python)
But I get this error when installing the package using the command (pip install fbprophet)
import pystan
File "e:\repos\usf\venv\lib\site-packages\pystan\__init__.py", line 9, in <module>
from pystan.api import stanc, stan
File "e:\repos\usf\venv\lib\site-packages\pystan\api.py", line 13, in <module>
import pystan._api # stanc wrapper
ImportError: DLL load failed: The specified module could not be found.
I have done some research and got to know that this is possible with conda. But I am looking for a solution without using conda.
Thanks in advance.
It says in the Pystan documentation that configuring a C++ compiler can be challenging on Windows. Following approach worked for me to install Pystan 2.17.1 and FBProphet 0.6:
Install C++ compiler, mingw-w64 (http://mingw-w64.org/doku.php/download) -> I selected this one https://sourceforge.net/projects/mingw-w64/files/
Add C:<MinGW_w64 installation directory>\bin to the PATH environment variable
Create a distutils.cfg file with the following contents in the folder \Lib\distutils in Python install directory (in venv):
[build]
compiler=mingw32
[build_ext]
compiler=mingw32
pip install numpy cython
pip install pystan==2.17.1
Verify the Pystan installation (https://pystan.readthedocs.io/en/latest/windows.html)
pip install fbprophet==0.6
Follow https://github.com/facebook/prophet/issues/1939
I had similar issues even after installing Mingw
conda install libpython m2w64-toolchain -c msys2
Solved all the errors and i am able to install fbprophet finally
Thanks
I had similar issues with my Python3.6 (anaconda)
I reinstalled anaconda for all users (with admin privileges) then
"conda install -c conda-forge pystan"
later i updated all other modules
it works without any error now
I have two python distributions(python2.7,python3.6) and in both I have installed pandas and numpy as well but cant use
These are the errors caused when i tried to import pandas
in python 2.7
File "/usr/local/lib/python2.7/dist-packages/pandas/init.py", line 19, in
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
then imported numpy
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: cannot import name multiarray
in python 3.6
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'pandas'
Most of these cases, the problem is that you are installing pandas in another environment. The easy solution here is using Anaconda.
Anaconda is focused on environments. First, you should choose installation of python2 or python3. Then, you can install this version of Anaconda in Linux: https://www.anaconda.com/download/#linux
For example:
64-Bit (x86) Installer (622 MB) Python3:
$ wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
Then you need, install in your system:
$ bash Anaconda3-5.2.0-Linux-x86_64.sh
Be cautious in the interactive dialog in order to install Anaconda. Remember the route of the installation.
When you have Anaconda in a folder named: anaconda 3 (for example). go to route: .../anaconda3/bin.
Now, you should execute:
$ source activate
Now you are in base environment, you can install the packages that you need (pandas and numpy are install by default). However, I recommend you create a new environment for each new proyect (see https://conda.io/docs/_downloads/conda-cheatsheet.pdf).
Imagine that you have (base) environment. In this environment try:
$ python
The first message gives you the python version. Anyway you can try:
>>> import sys
>>> sys.version
In order to know the version that you are using.
I'm trying to create an LMDB data base file in Python to be used with Caffe according to this tutorial. The commands import numpy as np and import caffe run perfectly fine. However, when I try to run import lmdb and import deepdish as dd, I'm getting the following errors:
>>> import lmdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lmdb
>>> import deepdish as dd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named deepdish
I'm running Python 2.7.9 through Anaconda 2.2.0 (64-bit) on Ubuntu 14.04. While installing the dependencies for Caffe according to this page, I've already installed the lmdb package through sudo apt-get install liblmdb-dev.
Any ideas why this error might be occuring?
Well, the apt-get install liblmdb-dev might work with bash (in the terminal) but apparently it doesn't work with Anaconda Python. I figured Anaconda Python might require it's own module for lmdb and I followed this link. The Python installation for lmdb module can be performed by running the command pip install lmdb in the terminal. And then import lmdb in Python works like a charm!
The above installation commands may require sudo.
If you're using Anaconda, then this can solve your problem (it worked for me):
conda install -c https://conda.binstar.org/dougal lmdb
For Anaconda users, installing python-lmdb package from conda-forge should fix the lmdb import error:
conda install -c conda-forge python-lmdb
This was tested on conda 4.5.11 on an lxc-containerized system running Ubuntu 18.04.
Note that there is a conda package named lmdb (without python-), installable via:
conda install -c conda-forge lmdb
that does not fix the import error.