Python Forum

Full Version: Troubleshooting site packages ('h5py' to be specific)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I want to install the 'h5py' package so I can view the contents of the '.h5' files that I have. I did pip install h5py2.10.0 and that installed the package successfully in my \Python\Lib\site-packages directory. I also added this directory in my path in Windows. But when I used the command import h5py in my script, I got an error saying "No module by the name h5py'. When I typed h5py --version I again got the error saying its not a recognized internal or external command.
Any ideas what I may be doing wrong?

Thanks!
(Nov-02-2020, 02:22 PM)aukhare Wrote: [ -> ]I also added this directory in my path in Windows
You shall not add site-packages to Path,only Python and Scripts root folders.
Look at the basic here stuff here Python 3.8 (3.6-3.7) and pip installation under Windows.
So test python and pip from command line,if trouble look at Fixing Path if needed.
Quick example:
# Test python
λ python -V
Python 3.8.3

# Test pip,will show path to Python version it install to
E:\div_code
λ pip -V
pip 20.2.3 from c:\python38\lib\site-packages\pip (python 3.8)

# Install h5py
E:\div_code
λ pip install h5py
Collecting h5py
  Downloading h5py-3.0.0-cp38-cp38-win_amd64.whl (2.7 MB)
     |████████████████████████████████| 2.7 MB 1.3 MB/s
Requirement already satisfied: numpy>=1.17.5; python_version == "3.8" in c:\python38\lib\site-packages (from h5py) (1.19.0)
Collecting cached-property
  Downloading cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)
Installing collected packages: cached-property, h5py
Successfully installed cached-property-1.5.2 h5py-3.0.0

# Test that it work
E:\div_code
λ python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
>>>
>>> h5py.__version__
'3.0.0'
>>> exit()