I am trying to make an app with android studio, i imported chaquopy and python runs it.. (app is ok fine but when start python script cv2 is missing)
in the python program I use opencv so I have to import the library the fact is that if I add:
python {
pip {
install "opencv-python"
}
}
in the defaultconfig and try sync now:
***
Process 'command 'python3.8'' finished with non-zero exit value 1
***
***
Execution failed for task ':app:generateDebugPythonRequirements'.
ModuleNotFoundError: No module named 'distutils.util'
***
***
> Process 'command 'python3.8'' finished with non-zero exit value 1
***
***
ModuleNotFoundError: No module named 'distutils.util'
***
***
Process 'command '/usr/bin/python3.8'' finished with non-zero exit value 1
***
gradle is update at last version
My bad I just need sudo apt-get install python3.8-distutils
now work
You probably need to install the python3-distutils or python3.8-distutils package.
Source: https://askubuntu.com/questions/1239829, which is the first Google result for this error message.
Related
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```
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
I am using python 3.5 and noticed that python setuptools would return exit code 0 even if the package compilation fails. What I did is simply python setup.py bdist_egg and then check the exit code echo $?. The stdout showed syntax errors in compilation but the exit code is 0. Is this expected in setuptools? If this is the case, what's the typical way to catch the package compilation error in a bash script?
Here is an example:
#setup.py
from setuptools import setup, find_packages
setup(
name="HelloWorld",
version= '0.1',
packages=find_packages(),
)
There is Hello directory, which only contains hello.py and __init__.py
The init.py has just one line "1 + ". This line produces syntax error as expected. when I run python setup.py bdist_egg , I do see the expected syntax error on stdout:
byte-compiling build/bdist.linux-x86_64/egg/Hello/hello.py to hello.cpython-36.pyc
File "build/bdist.linux-x86_64/egg/Hello/hello.py", line 1
1 +
^
SyntaxError: invalid syntax
However, when I check the return code echo $?, it showed 0. Is this an expected behavior of setuptools by design? If so, how can I know in a shell script that the package is sucessfully built or fails?
Update
This is a known issue and it has been discussed in a github issue https://github.com/pypa/setuptools/issues/1637 though it seems that not many people care about it.
I want to report those modules which failed to install by checking for any errors. Suppose I have a code with wrong or misspelled module-name. I want my code to print the module name for which installation failed due to some reason. For example:
import pip
pip.main(['install', 'someMisspelledModuleName==1.2.3'])
I have a dictionary from which I am reading such module names and their versions and installing it from my code itself in Python 3.4. When I am executing this script in Python Shell, it just gives red-coloured warning, which is not an error and hence I can't handle it.
Please tell me how to handle such cases?
pip.main(…) returns a status code, one of the predefined. Just check if it's SUCCESS or no:
import sys, pip
rc = pip.main(['install', 'someMisspelledModuleName==1.2.3'])
sys.exit(rc)
I just exit here using the result code.
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.