Error when compiling pytorch: 'cstdint' file not found - pytorch

I was attempting to compile pytorch using NO_CUDA=1 python setup.py install on Mac OS X, but I got these errors:
In file included from /Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Tensor.hpp:3:
/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Storage.hpp:6:10: fatal error:
'cstdint' file not found
#include <cstdint>
^
1 error generated.
In file included from torch/csrc/autograd/functions/init.cpp:2:
In file included from torch/csrc/autograd/functions/batch_normalization.h:4:
In file included from /Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/THPP.h:4:
/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Storage.hpp:6:10: fatal error:
'cstdint' file not found
#include <cstdint>
^
1 error generated.
1 error generated.
1 error generated.
1 error generated.
In file included from torch/csrc/autograd/python_hook.cpp:5:
In file included from /Users/ezyang/Dev/pytorch-tmp/torch/csrc/THP.h:32:
/Users/ezyang/Dev/pytorch-tmp/torch/csrc/utils.h:6:10: fatal error:
'type_traits' file not found
#include <type_traits>
^
13 errors generated.
1 error generated.
1 error generated.
error: command 'gcc' failed with exit status 1

You need to setup environment variables to have Python use the correct C compiler on OS X. You should do this instead:
NO_CUDA=1 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install

Related

Installation of back-level version of h5py (2.10.0) fails .... wheel fails to build

I've tried this on Intel and ARM and both times it fails. I'm using a program, that needs to use 2.10.0. The 3.1.0 version works fine. I've played around with different dependencies and dead stuck.
Cam anyone help me figure out how to get this on either Mac?
Here is the error at the end:
#warning "Using deprecated NumPy API, disable it with " \
^
In file included from /private/var/folders/0m/8fmd9y8509v4xdcglsxv5rg40000gn/T/pip-install-0sjv5knz/h5py_75305355e2ca4b928d9fd980a5e2af77/h5py/defs.c:790:
./h5py/api_compat.h:27:10: fatal error: 'hdf5.h' file not found
#include "hdf5.h"
^~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: No metadata found in /Users/p/.virtualenvs/pzdemo-fawkes/lib/python3.8/site-packages
Rolling back uninstall of h5py
Moving to /Users/p/.virtualenvs/pzdemo-fawkes/lib/python3.8/site-packages/h5py-3.8.0.dist-info/
from /Users/p/.virtualenvs/pzdemo-fawkes/lib/python3.8/site-packages/~5py-3.8.0.dist-info
Moving to /Users/p/.virtualenvs/pzdemo-fawkes/lib/python3.8/site-packages/h5py/
from /Users/p/.virtualenvs/pzdemo-fawkes/lib/python3.8/site-packages/~5py
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> h5py```

Cant install Pyhash package on Mac OS 12.3.1 Monterey

I get this error when I run 'pip3 install pyhash'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^ ~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pyhash
What can I do to fix this. I have spent many hours trying to figure this out and it always leads me to this same error.

Error while creating wheel while installing packages in Mac

This is the error I receive while installing packages from a file using pip install -r req.txt
Then it tried building wheels for collected packages: blis; cytoolz; murmurhash; preshed; regex, and I got a long error list.
typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
^
note: '__uint128_t' declared here
In file included from Python3/_regex.c:46:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_wctype_t;
^
note: '__uint128_t' declared here
In file included from Python3/_regex.c:46:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:75:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
#error architecture not supported
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'xcrun' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for regex```
Is something wrong with MacOS side because it is giving me bizarre errors.
Any leads appreciated.

Installing pytorch fails - fatal error: libavutil/motion_vector.h: No such file or directory

I'm trying to install pytorch
python setup.py install
but it fails as it can't locate libavutil/motion_vector.h
[ 66%] Building CXX object caffe2/CMakeFiles/torch.dir/video/video_input_op.cc.o
In file included from /root/pytorch/caffe2/video/video_input_op.h:15:0,
from /root/pytorch/caffe2/video/video_input_op.cc:1:
/root/pytorch/caffe2/video/video_decoder.h:15:37: fatal error: libavutil/motion_vector.h: No such file or directory
#include <libavutil/motion_vector.h>
^
compilation terminated.
[ 66%] Building CXX object caffe2/CMakeFiles/torch.dir/video/video_io.cc.o
make[2]: *** [caffe2/CMakeFiles/torch.dir/video/video_input_op.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /root/pytorch/caffe2/video/video_io.h:6:0,
from /root/pytorch/caffe2/video/video_io.cc:1:
/root/pytorch/caffe2/video/video_decoder.h:15:37: fatal error: libavutil/motion_vector.h: No such file or directory
#include <libavutil/motion_vector.h>
^
compilation terminated.
make[2]: *** [caffe2/CMakeFiles/torch.dir/video/video_io.cc.o] Error 1
make[1]: *** [caffe2/CMakeFiles/torch.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
File "setup.py", line 759, in <module>
build_deps()
File "setup.py", line 321, in build_deps
cmake=cmake)
File "/root/pytorch/tools/build_pytorch_libs.py", line 63, in build_caffe2
cmake.build(my_env)
File "/root/pytorch/tools/setup_helpers/cmake.py", line 330, in build
self.run(build_args, my_env)
File "/root/pytorch/tools/setup_helpers/cmake.py", line 143, in run
check_call(command, cwd=self.build_dir, env=env)
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '12']' returned non-zero exit status 2
What I've tried so far:
installed libavutil-dev
ensured ffmpeg is installed
followed https://github.com/facebookresearch/VMZ/blob/master/tutorials/Installation_guide.md
Any other ideas?
Missing headers of libraries commonly indicate missing development packages. For Debian and Ubuntu the package you are looking for is most likely called libavutil-dev. Try installing this package using you package manager and re-running the pip installation. For Fedora and SUSE the package should end with -devel.
For conda installation, firstly create an env, very important because you've used pip (pip stops conda seeing it's base env).
conda create -n pytorch_env python=3.7
source activate pytorch_env
conda install -c anaconda mkl
Then install pytorch and torch vision
conda install -c pytorch pytorch torchvision
You might want to run these as administrator, for me not needed.
You will need to install Caffe via
conda install -c caffe2 pytorch-nightly
There's a bug for caffe2 installation (not nightly). Corrected below,
conda create -n pytorch_env python=3.6
source activate pytorch_env
conda install -c caffe2 caffe2
Having done this I found opencv and ffmpeg were loaded .. I can only assume they were a dependency of caffe2. Thus in summary yes you can do the whole thing easily via conda once the 3.7 -> 3.6 bug is resolved

Installing octave package in ubuntu

anyone can help me with this error?
octave:4> pkg install signal-1.2.0.tar.gz
error: the following dependencies where unsatisfied:
signal needs optim >= 1.0.0
signal needs specfun >= 0.0.0
signal needs control >= 2.2.3
signal needs general >= 1.3.2
octave:4> pkg install optim-1.2.2.tar.gz
error: the following dependencies where unsatisfied:
optim needs miscellaneous >= 1.0.10
optim needs struct >= 1.0.10
octave:4> pkg install struct-1.0.10.tar.gz
make: /usr/bin/mkoctfile: Command not found
make: *** [fields2cell.oct] Error 127
'make' returned the following error: make: Entering directory `/tmp/oct-fDBs5k/struct-1.0.10/src'
/usr/bin/mkoctfile -s fields2cell.cc
make: Leaving directory `/tmp/oct-fDBs5k/struct-1.0.10/src'
error: called from `pkg>configure_make' in file /usr/share/octave/3.6.2/m/pkg/pkg.m near line 1391, column 9
error: called from:
error: /usr/share/octave/3.6.2/m/pkg/pkg.m at line 834, column 5
error: /usr/share/octave/3.6.2/m/pkg/pkg.m at line 383, column 9
I need to install signal package, but I have to download other to work from I have noticed but it gets stuck when installing struct package.
#edit
The same error when trying to install misc~ package.
octave:5> pkg install miscellaneous-1.2.0.tar.gz
error: the following dependencies where unsatisfied:
miscellaneous needs general >= 1.3.1
octave:5> pkg install general-1.3.2.tar.gz
make: /usr/bin/mkoctfile: Command not found
make: *** [__exit__.oct] Error 127
'make' returned the following error: make: Entering directory `/tmp/oct-CA6o4U/general/src'
/usr/bin/mkoctfile __exit__.cc
make: Leaving directory `/tmp/oct-CA6o4U/general/src'
error: called from `pkg>configure_make' in file /usr/share/octave/3.6.2/m/pkg/pkg.m near line 1391, column 9
error: called from:
error: /usr/share/octave/3.6.2/m/pkg/pkg.m at line 834, column 5
error: /usr/share/octave/3.6.2/m/pkg/pkg.m at line 383, column 9
#edit
additional info:
octave:6> which mkoctfile
`mkoctfile' is a function from the file /usr/share/octave/3.6.2/m/miscellaneous/mkoctfile.m
I have no idea what to do..
You need to install mkoctfile. Depending on your ubuntu version this will be in different packages. It used be in octave-pkg-dev but now is on liboctave-dev.
Ubuntu and Debian place this as separate package because it is only needed if you want to build the packages yourself. They expect you to use the Octave packages that they packaged (sudo apt-get install octave-signal). Their versions will be behind the actual version but the same happens with the Octave version they distribute. That's the price to pay for stability.

Resources