I've been trying to import h5py to read this type of file.
Here is my code:
import h5py
file_1 = h5py.File("Out_fragment.h5py")
print file_1
The output is:
Traceback (most recent call last):
File "./week11.py", line 17, in <module>
import h5py
ImportError: No module named h5py
I also used pip install h5py to get this module and am not sure why it did not seem install properly.
Thanks.
On Ubuntu. You can try the following three commands:
sudo pip install cython
sudo apt-get install libhdf5-dev
sudo pip install h5py
source: https://github.com/fchollet/keras/issues/3426
For windows you just need to install it normally using easy install feature:
pip install h5py
you can visit their website from here: H5py
Related
I have tried
pip install mlrose
pip3 install mlrose
sudo pip install mlrose
they all show the Requirement already satisfied, but when I come to Jupyterlab to implement import mlrose, it raises an error
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-e28c59840eed> in <module>
----> 1 import mlrose
ModuleNotFoundError: No module named 'mlrose'
Install your packages direct from Jupyter notebook, then you can be sure that the packages are being installed into the local python instance.
! pip install --user <package>
The ! tells the notebook to execute the cell as a shell command.
Then try:
conda update --all
When I import Image from PIL I get this error message.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.8/site-packages/PIL/Image.py", line 94, in <module>
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/home/pi/.local/lib/python3.8/site-packages/PIL/__init__.py)
The way it says to install pillow errors out for me
pip install --upgrade Pillow
It says that it doesn't have the .whl so it defaults to the old setup.py then errors and doesn't install.
only
sudo apt install python3-pil
seems to install pillow correctly
this is for python3.8.x
Try using pip3 instead of pip. pip sometimes defaults to Python 2.x. See the following question to change this behavior: How to override the pip command to Python3.x instead of Python2.7?
pip3 install --upgrade Pillow
I tried to install pip manager using the file get-pip.py as mentioned in the documentation- https://pip.pypa.io/en/stable/installing/
So, I downloaded the file and ran python get-pip.py and as a result, I had permission issues. So I again ran sudo python get-pip.py and it worked.
Now I wanted to install numpy. So I ran pip install numpy and it showed me the Import Error saying-
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
But again when I ran sudo pip install numpy, it worked and got installed. Now, for every python script involving these pip packages, I have to run the script using sudo which I don't like. So how can I resolve these permission issues?
Just to mention-
python v2.7.12
pip v9.0.1
pip installation location- /usr/local/lib/python2.7/dist-packages
I try to import scikit-learn, but there is an error. i installed sklearn, scipy on anaconda. i am using W10 and python 3.5.
>>> import sklearn
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import sklearn
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\base.py", line 9, in <module>
from scipy import sparse
ImportError: No module named 'scipy'
In linux there is pip install <module> to install a module, and if you are using anaconda then conda install <module>, I believe there would be something similar in windows.
If you are sure that you have installed scipy module, then probably the python path is not looking for those directories.
You can try a environment variable PYTHONPATH that has a list of directories to append before launching python prompt. OR you can test it for a session by adding it to sys.path
Use pip to install the packages
pip install numpy
pip install scipy
pip install -U scikit-learn
Ensure you have appropriate privileges for installing globally or in virtual environment.
Using pip, or interpreter setting in pycharm:
pip install NumPy+mkl
numpy-mkl 1.10.2
Install module NumPy+mkl
pip install SciPy
Install module SciPy
Now you can install sklearn.
pip install scikit-learn
Install module scikit-learn
Hope that it is useful.
I'm trying to generate .docx files using Python. I searched the web and posts here and found a module:
https://github.com/mikemaccana/python-docx/blob/master/README.markdown
It says to install using easy_install or pip, which I have no idea how to do. I went to python website to install pip from the instructions given on python documentation:
http://guide.python-distribute.org/installation.html
So I downloaded and followed directions:
$ tar xzf pip-0.7.2.tar.gz
$ cd pip-0.7.2
$ python setup.py install
But when I do python setup.py install, I get error message:
Johns-MacBook-Pro:pip-0.7.2 John$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 2, in <module>
from setuptools import setup
ImportError: No module named setuptools
Can someone please help me install step by step for a newb? Thanks in advance for all of your help!
Pip can install straight from the git repository
You just have to tell him to use git and give him the URL of the git rep
pip install git+git://github.com/mikemaccana/python-docx.git
You will also need to install lxml (as written in the setup.py) and PIL (as you will discover when you try to import the module).
pip install PIL
pip install lxml
pip install python-dateutil