Could not find HDF5 installation for PyTables on M1 Mac - homebrew

Running on M1 Mac, macOS Monterey 12.4, Python 3.10.3
pip install tables
Collecting tables
Using cached tables-3.7.0.tar.gz (8.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
/var/folders/6g/9c7g_2tx2sb7lp8ttwtfky640000gn/T/H5closew_79lujq.c:2:5: error: implicit declaration of function 'H5close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
H5close();
^
1 error generated.
cpuinfo failed, assuming no CPU features: No module named 'cpuinfo'
* Using Python 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)]
* Found cython 0.29.30
* 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.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I tried the following from this GitHub Issue:
pip install cython
brew install hdf5
brew install c-blosc
export HDF5_DIR=/usr/local/
export BLOSC_DIR=/usr/local/
pip install tables
But still getting the same error. Not sure if it's due to Homebrew using a different path on M1 Macs?

The issue is that Homebrew puts the files in opt/homebrew/opt/
This fixed it for me:
export HDF5_DIR=/opt/homebrew/opt/hdf5
export BLOSC_DIR=/opt/homebrew/opt/c-blosc

Again in completion to remove confusion. Running the following in terminal on Mac M1 should work.
pip install cython
brew install hdf5
brew install c-blosc
export HDF5_DIR=/opt/homebrew/opt/hdf5
export BLOSC_DIR=/opt/homebrew/opt/c-blosc
pip install tables

A solution from here solved the issue for me:
https://github.com/freqtrade/freqtrade/issues/4162
Scroll down and see "solution" provided by camxus

Related

can you help me to install kivy from vscode?

error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [11 lines of output]
DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary
will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion
can be found at https://github.com/pypa/pip/issues/11453
Collecting setuptools
Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting cython!=0.27,!=0.27.2,<=0.29.28,>=0.24
Using cached Cython-0.29.28-py2.py3-none-any.whl (983 kB)
Collecting kivy_deps.gstreamer_dev~=0.3.3
Using cached kivy_deps.gstreamer_dev-0.3.3-cp311-cp311-win_amd64.whl (3.9 MB)
ERROR: Could not find a version that satisfies the requirement kivy_deps.sdl2_dev~=0.4.5 (from versions: 0.5.1)
ERROR: No matching distribution found for kivy_deps.sdl2_dev~=0.4.5
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip
install kivy in vscode from windows

Installing python module in Robomaker ROS workspace with colcon

I'm working on a cloud-based robotic application with AWS RoboMaker. I'm using ROS Kinetic, with the build tool colcon.
My robot application depends on a custom python module, which has to be in my workspace. This python module is built by colcon as a python package, not a ROS package. This page explains how to do that with catkin, but this example shows how to adapt it to colcon. So finally my workspace looks like that :
my_workspace/
|--src/
|--my_module/
| |--setup.py
| |--package.xml
| |--subfolders and python scripts...
|--some_ros_pkg1/
|--some_ros_pkg2/
|...
However the command : colcon build <my_workspace> builds all ROS packages but fails to build my python module as a package.
Here's the error I get :
Starting >>> my-module
[54.297s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'my-module' doesn't explicitly install a marker in the package index (colcon-ros currently does it implicitly but that fallback will be removed in the future)
[54.298s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'my-module' doesn't explicitly install the 'package.xml' file (colcon-ros currently does it implicitly but that fallback will be removed in the future)
--- stderr: my-module
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'egg_info'
---
Failed <<< my-module [0.56s, exited with code 1]
I found this issue that seems correlated, and thus tried : pip install --upgrade setuptools
...Which fails with the error message :
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/7c/1b/9b68465658cda69f33c31c4dbd511ac5648835680ea8de87ce05c81f95bf/setuptools-50.3.0.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "setuptools/version.py", line 1, in <module>
import pkg_resources
File "pkg_resources/__init__.py", line 1365
raise SyntaxError(e) from e
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uwFamt/setuptools/
And with pip3 install --upgrade setuptools, I get :
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: setuptools in /home/ubuntu/.local/lib/python3.5/site-packages (50.3.0)
I have both Python 3.5.2 an Python 2.7, but I don't know which one is used by colcon.
So I don't know what to try next, and what the real problem is. Any help welcome !
I managed to correctly install my package and its dependencies. I develop the method below, in case it may help someone someday !
I have been mainly inspired by this old DeepRacer repository.
The workspace tree in the question is wrong. It should look like this:
my_workspace/
|--src/
|--my_wrapper_package/
| |--setup.py
| |--my_package/
| |--__init__.py
| |--subfolders and python scripts...
|--some_ros_pkg1/
|--some_ros_pkg2/
my_wrapper_package may contain more than one python custom package.
A good setup.py example is this one.
You shouldn't put a package.xml next to setup.py : colcon will only look at the dependencies declared in package.xml, and won't collect pip packages.
It may help sometimes to delete the folders my_wrapper_package generated by colcon in install/ and build/. Doing so you force colcon to rebuild and bundle from scratch.

Cannot compile Open CV on Ubuntu 18.04 because of jasper.h not found

I am trying to compile Opencv on Ubuntu 18.04. I installed many dependencies packages but when I run make I get the error:
grfmt_jpeg2000.cpp:59:10: fatal error: jasper/jasper.h: No such file or directory
#include <jasper/jasper.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
I had already jasper installed and installed libjasperreports-java. However the file jasper.h cannot still be found in my system. Is there any library I can install with apt install to get that file? Or am I missing any other library?
EDIT 1
I tried also downloading the opencv_contrib to install extra moduels of openCV but first of all jaspar is not present and secondly setting the build with
cmake -D CMAKE_INSTALL_PREFIX=./ -D CMAKE_BUILD_TYPE=Debug -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ../openCV
returns the error:
Make Error at cmake/OpenCVModule.cmake:352 (message):
Duplicated modules NAMES has been found
while CMakeError.log contains many errors of the type:
Build output check failed:
Regex: 'command line option .* is valid for .* but not for C\+\+'
Output line: 'cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++'

Installing Circos: Problems installing GD module on Mac OS

I would like to install Circos. I followed the instructions on Circos website. In particular, I checked for missing perl modules. I'm missing several of them:
missing Font::TTF::Font
missing GD
missing GD::Polyline
missing SVG
missing Statistics::Basic
missing Text::Format
So I followed again the instructions about Installing Perl Modules on Mac OS X on Circos website. Specifically, I followed the detailed instructions in Paulo Nuin's blog post. Freetype and Fontconfig were missing and I installed them.
Now, when I run the configuration for libgd-2.2.1, I get this configuration summary:
Support for Zlib: yes
Support for PNG library: yes
Support for JPEG library: yes
Support for WebP library: no
Support for TIFF library: no
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: no
Support for liq library: no
Support for pthreads: yes
It looks good enough to me. But when I run the make, I get errors:
clang: warning: argument unused during compilation: '-pthread'
ld: malformed 64-bit a.b.c.d.e version number: 4.20201
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libgd.la] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
Since it was not working, I followed this recommendation on Stackoverflow and I ran
brew install gd
(I had to update brew by doing
cd /usr/local/Library
git pull origin master
following this answer on Stackoverflow.)
But I get an error:
Error: You must `brew link libpng freetype` before gd can be installed
And when I run 'brew link libpng freetype', I get another error:
Linking /usr/local/Cellar/libpng/1.6.21...
Error: Could not symlink bin/libpng-config
Target /usr/local/bin/libpng-config
already exists. You may want to remove it:
rm '/usr/local/bin/libpng-config'
To force the link and overwrite all conflicting files:
brew link --overwrite libpng
To list all files that would be deleted:
brew link --overwrite --dry-run libpng
Any solution to finally be able to run Circos?
Thanks in advance for your help!
Finally, I solved the problem by changing the permissions in /usr/local:
sudo chown -R $(whoami) /usr/local
Following the recommendations on brew webpage.
Once this was solved, I just installed GD in Perl, as described in the last step in Paulo Nuin's post.

Installing opencv for python3

Has anyone tried to install opencv for python3?. As stated here http://opencv.willowgarage.com/wiki/InstallGuide its support status is unknown. So I want to try it:
I have downloaded the sources for OpenCV-2.3.1. But cmake reports.
-- Python interpreter: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3 -B (ver
3.2)
-- Python numpy: NO (Python wrappers will not be generated)
I do have numpy (version 1.6.0) installed in python3 but cmake does not find it. I am using Mac OSX 10.6 Any ideas?
Update
I just saw one more thing of the cmake output that might be helpful
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3 (found
version "3.2")
-- Found PythonLibs: /usr/lib/libpython2.6.dylib File "", line 1
from distutils.sysconfig import *; print get_python_lib()
^
SyntaxError: invalid syntax File "", line 1
import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print
numpy.distutils.misc_util.get_numpy_include_dirs()[0]
^
SyntaxError: invalid syntax File "", line 1
import sphinx; print sphinx.__version__
^ SyntaxError: invalid syntax
Notice that it found 3.2 but then libpython2.6 ??
Any ideas?
At the moment OpenCV supports Python 2.x only. OpenCV (including OpenCV 2.4) does not compiles with Python 3.x.
Python3 support is already in wishlist for future versions of OpenCV. But currently there are no activities in this direction and you are welcome to create and contribute a patch resolving the compatibility issues.
Use the pip application.
On ubuntu:
sudo apt install python3-pip
and so, on command line:
pip3 install --upgrade pip
pip3 install opencv-python
I got the thing to at least build and install. It can load the cv2 module just fine. Haven't tested too much though.
Details:
https://stackoverflow.com/a/21212023/3075814

Resources