I tried installing python library tables through: pip install tables
This results in an error
Collecting tables Using cached https://files.pythonhosted.org/packages/4d/53/8f34ce887c2a2ad80518980419a5f6f41defc85a287a355987e559ce9385/tables-3.4.4.tar.gz
Complete output from command python setup.py egg_info:
H5closeplbq5iz8.c
C:\Users\tkim1\AppData\Local\Temp\H5closeplbq5iz8.c(2): warning C4013: 'H5close' undefined; assuming extern returning int
LINK : fatal error LNK1181: cannot open input file 'hdf5.lib'
* Using Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the ``HDF5_DIR`` environment
variable or by using the ``--hdf5`` command-line option.
This issue with HDF5 not being found seems to be a common one: https://github.com/PyTables/PyTables/issues/219, https://github.com/PyTables/PyTables/issues/385. But as a newcomer to coding, I am having a hard time following the discussion.
One of the most baffling thing I have encountered in trying to fix this is many of the terminal codes that are being discussed is just not taken by my terminal.
sudo python setup.py build_ext --inplace --hdf5=/opt/local --lzo=/opt/local --bzip2==opt/local
output: 'sudo' is not recognized as an internal or external command,operable program or batch file.
env HDF5_DIR=$PWD pip install tables
output:'env' is not recognized as an internal or external command,operable program or batch file.
Any help in regard to fixing this installation issue or regarding how I can apply these different terminal commands will be super appreciated. Thanks everyone.
I found a solution works on Windows 10 with Visual Studio 2019 Community and Python 3.9.1.
Download HDF5 and install.
Set two environment variables, change the version if necessary.
HDF5_DIR=C:\Program Files\HDF_Group\HDF5\1.12.0
LIB=C:\Program Files\HDF_Group\HDF5\1.12.0\lib
The HDF5_DIR is not equale to the HDF5's README, it tells you to set it to C:\Program Files\HDF_Group\HDF5\1.12.0\cmake to working with Cmake, but it is not compatiable with pyTables setup.py.
LIB environment variable tells the link.exe where to find hdf5.lib, if this variable is not set, it shows a link error complain it can't find hdf5.lib on my system.
After the two environment variables set, I can install pyTables via pip install tables.
You can verify these settings in powershell by $env:HDF5_DIR and $env:LIB.
As hinted in this duplicate question, if using conda is an option, conda install pytables will most likely fix the issue in a Windows environment (tested on Windows 10, python 3.9, tables 3.6.1)
Related
I am currently running a source code in python which uses METIS. I wanted to run it using Jetbrains PyCharm, conda interpreter and these are installed on windows 10. Although I have installed METIS using conda, I could not enable shared libraries and I faced this error:
ModuleNotFoundError: No module named 'metis'
When I tried to run it without conda I faced the following error although I have added the metis.dll location to the environment variables.
RuntimeError: Could not load METIS dll
Could anyone please help me about it?
This question is old, but I ran into the same problem and after going down the rabbit's hole for.. too long... I have an answer that worked for me.
First, you should get the python metis wrapper using pip: pip install metis.
Second, You must install conda-metis, which you can find here. Although pip calls the metis python wrapper metis, it just the metis wrapper and does not have metis itself.
Place the files in conda-metis-master in some file path.
The installation requires some fixes. Make sure you have a recent version of Visual Studios (I used 2017). For me, VS had a problem running the instructions in BUILD-WINDOWS.txt, which landed me on this thread:
Why does MSBuild look in C:\ for Microsoft.Cpp.Default.props instead of c:\Program Files (x86)\MSBuild? ( error MSB4019)
Specifically, the answer For Visual Studio 2017 and 2019 on Windows 10 was what I went with. Run:
set VCTargetPaths=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets
in command prompt with full permissions to set the environment variable.
Also go to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ in regedit and change in 4.0 the variable MSBuildOverrideTasksPath and in ToolsVersion\4.0\ the variable MSBuildToolPath to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin.
For the python metis, we need a .dll, not .lib[1], so we must also look closer at the CMakeLists.txt (see the Linux version of this discussion here). We add on line 19: set(METIS_LIBRARY_TYPE SHARED).
You should follow the BUILD-WINDOWS.txt instructions, but run .\vsgen -G "Visual Studio 15 2017 Win64" inside your conda-metis file path in command prompt with full permissions instead of using Visual Studio 10.
Wait! We need another fix before following the instructions further on using VS to build the the library. Following what was said in:
rint() issue after creating VS Project using CMake
we have to edit the file path_to_your_metis_dir\GKlib\gk_arch.h by removing the line: #define rint(x) ((idx_t)((x)+0.5)). (Or the fix listed on this github exchange.)
Then go to path_to_your_metis_dir\build\windows\.
Open METIS.sln in Visual Studios, go to the top to Build and from the scroll-down go to Build Solution. Afterwards, the .dll file will be in path_to_your_metis_dir\build\windows\libmetis\Release\.
Last, we run in command prompt:
set METIS_DLL=path_to_your_metis_dir\build\windows\libmetis\Release\metis.dll
After this, python metis no longer failed on the step from metis import * for me.
[1] If we could use .lib, then conda install -c conda-forge metis would work to get this file, but setting METIS_DLL to the .lib file leads to a windows error.
After getting the error described by #XiaojianChen , this is how I solved it (VS Studio 2022). Continuing after the above fixes, to generate a .dll file after opening up the VS solution file, go to the Solution Explorer, right click on the metis project file -> properties.
In General Properties, change the configuration type to Dynamic Library (.dll)
Screenshot of General Properties window
Under Advanced Properties, change the Target File Extension from .lib to .dll
Screenshot of Advanced Properties window
Since we only need the metis.dll file, right click the metis project file in the Solution Explorer and click build. The .dll can be found in ..\build\windows\libmetis\Release.
I have installed the HDF5.dll and HDF5dll.dll in every directory I can think of--PYTHONPATH, USERPROFILE, within the PyTables site-packages folder--and I still return the following error:
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path
Both of these are definitely within the system path and I still can't test PyTables without this message. Does anyone know how to solve this? Thank you!
I have the same error in Python 3.6.0 (x64) under Windows 10. Anecdotally, based on Google searches, there are reports that tables is broken for Python 3 since June 2017, and apparently not fixed yet.
However, I can import tables in Python 2.7.13 (x64) under Windows 10. So see if you can run your script under Python 2.7.
I installed PyTables 3.5.2 from PyPI and got
"Fail: ImportError: HDFStore requires PyTables, "Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path"
when trying to pandas.read_hdf(). Then I followed a link on https://www.pytables.org/usersguide/installation.html to Christoph Gohlkes page https://www.lfd.uci.edu/~gohlke/pythonlibs/ and downloaded tables‑3.5.2‑cp37‑cp37m‑win_amd64.whl from there. After a pip uninstall/install everything is working fine now. I still don't have a hdf5*.dll in my path ...
I had no luck with the documentation and every single post I went thru. I kept getting:
LINK : fatal error LNK1181: cannot open input file 'hdf5.lib'
* Using Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
* USE_PKGCONFIG: False
* Found HDF5 using system PATH ('C:\Users\<user>\AppData\Roaming\Python\Python39\site-packages\h5py')
.. ERROR:: Could not find a local HDF5 installation.
This did the trick, though:
Copy hdf5.dll to
C:\Users<user>\AppData\Roaming\Python\Python39\site-packages\tables
Latest dll can be found here: https://pypi.org/project/h5py/#files:
pip install -U C:\downloads\h5py-3.1.0-cp39-cp39-win_amd64.whl
I did add h5py to my Windows Path at some stage.
Ex: C:\Users<user>\AppData\Roaming\Python\Python39\site-packages\h5py
But I can't confirm the impact of that.
Having a nightmare here, been trying for hours with no luck. I'm using anaconda with a virtual environment on python 3.4 (I want to use geopandas, can't use 3.5) on windows 10. This is superset by the way: https://github.com/airbnb/superset
I also tried in my root conda environment but same issues.
First I do
activate py34
Then I tried two methods, A)
pip install superset
gives the error message
error: Microsoft visual c++ 10.0 is required. get it with "microsoft windows sdk 7.1" python
and B)
Download the source files and go to the directory and
setup.py install
Produces a different output but the same error message.
So I tried installing the SDK as suggested (standard UI installation like a normal windows program), but then I get an error with no code or information provided:
Installation of the "Microsoft Windows SDK for Windows 7" product has reported the following error: Please refer to Samples\Setup\HTML\ConfigDetails.htm document for further information"
There is no error code provided and I also don't know where that ConfigDetails.htm file is.
I tried installing a more recent SDK found here but still the same problems: https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk
Any ideas? I'm relatively new to python and find packages the most difficult thing ever, so if the answer is obvious then sorry.
Migrating OP's solution from a comment to an answer:
In the end the best solution was to install Cygwin and install Superset within Linux.
AndyMoore - Mar 2, 2017 at 20:50
I am trying to install python through cygwin on a windows machine in order to make use of a statistical program that can only be implemented using python in a linux environment.
I have run setup-x86_64.exe and installed all python related cygwin packages in an attempt to install python, but when I open a terminal and type python I just get
$ python
-bash: python: command not found
which is the same for all python commands I try so clearly the installation has not occurred. However, I have found a path to Python-2.7.9 which appears to contain the files required to build python from source.
When I run ./configure it is successful, but when I then input make it fails due to:
File "build/temp.cygwin-1.7.35-x86_64-2.7/libffi/fficonfig.py", line 33, in <module>
ffi_sources += ffi_platforms['X86_WIN64']
KeyError: 'X86_WIN64'
Makefile:488: recipe for target 'sharedmods' failed
make: *** [sharedmods] Error 1
Anyone know why make won't work?
The options in ./configure --help are unfamiliar to me, could any of these options allow for successful installation?
Any ideas would be greatly appreciated, thank you.
Cygwin comes with an installer, called setup.exe or setup-x86_64.exe. Just run it and type python to the search box. Then let it install it for you.
python language interpreter is the basic package you need.
So, this question is 3 years old, but this error still happens with most recent versions of Python 2 (tested with 2.7.13 and 2.7.15)
I was able to get python to build by modifying the following file in the build directory.
--- build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py~ 2018-11-03 14:51:53.290000000 -0400
+++ build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py 2018-11-03 14:53:41.793000000 -0400
## -9,6 +9,7 ##
'X86': ['src/x86/ffi.c', 'src/x86/sysv.S', 'src/x86/win32.S'],
'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+ 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'],
'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
The source files, in particular src/x86/win64.S, are present in the source tree. For some reason, ./configure does not seem to be properly adding the option to the dictionary in the fficonfig.py file, which causes the KeyError posted in the question. After making this modification, make and make install completed successfully and I was able to install an alternate version of python in addition to the normal Cygwin package.
I'm not yet sure why this happens, but I thought I would attempt to provide a solution to the question actually asked rather than just telling the asker to install a pre-compiled version using the package manager.
Since building Python from source was said to be a bad idea, I assumed my Cygwin was broken. I attempted to uninstall Cygwin following the instructions on the Cygwin website, but I was unable to remove it due to permission difficulties (I use a university-supplied Windows machine). My last resort was to run the Cygwin installation wizard setup-x86_64.exe and uninstall all packages, then run the wizard once more and select the necessary packages again as if starting from new. Miraculously, installing the required packages from scratch solved the problem and I am now running Python through my Cygwin terminal with no errors.
If you want to run Python on Cygwin, you might need to build it from source.
download the source
unpack it to the directory you could delete later, eg: build
run Cygwin, type: cd /path/to/build
run ./configure --help and read the help about the options you'll need
./configure #options
make
When attempting to install the scikit-bio toolkit via pip on Windows XP using Python 2.78 and Visual C++ 2008 Express Edition, the process is interrupted with the following message issued by VC:
cl : Command line error D8021 : invalid numeric argument '/Wno-error=declaration
-after-statement'
Concerning this error, Microsoft Developer Network website just says:
invalid numeric argument 'number'
A number greater than 65,534 was specified as a numeric argument.
I did not (yet) attempted to install scikit-bio under Linux (Ubuntu 12.04 Precise), but I am under the impression that it will work fine (as everything goes as regards Linux).
Has anyone ever succeeded installing scikit-bio under Windows (XP, 7, 8)? Any hints?
Thanks in advance!
I've installed Anaconda's Python (3.5) on a Windows 10 machine. As you should know, there is no official version of scikit-bio for this platform, but you can install it with this workaround:
Download the latest source from the Scikit-bio Github repository.
Using a tool like 7-zip, unzip it at your home directory.
Open a command line client and change to the source's directory
cd %HOMEPATH%\scikit-bio-master
Using Notepad++ edit the file setup.py
"C:\Program Files (x86)\Notepad++\notepad++" setup.py
Look for the line where the ssw_extra_compile_args variable is defined and change it. You can comment the previous version and redefine the variable in a new line:
#ssw_extra_compile_args = ['-Wno-error=declaration-after-statement']
ssw_extra_compile_args = []
Save the changes, close the editor and run the installation with this command:
python setup.py install
Hopefully you won't receive any error messages. Open an Anaconda's Python session (using the command python) and test if Scikit-Bio was installed rightly using print(skbio.art).
By the way, I've previously installed Visual Studio 2015 Community Edition with C++ SDK features enabled, in order to meet the compiler requirements for the package (Scikit-Bio) installation.
At this time, scikit-bio doesn't officially support windows. We'd definitely be interested in hearing about people's efforts to install, test, and use scikit-bio on Windows, but we don't have developers with expertise in this area.
This is related to biocore/skbio#941.