I recently upgraded to MacOS Sierra and I have been dealing with many issues (I am mentioning it cause it may be relevant). I am trying to install opencv-3.1.0 to use with python 2.7. and it's been impossible. I downloaded opencv-3.1.0 from here unzipped it and ran:
python platforms/osx/build_framework.py osx
from the opencv-3.1.0 directory. Don't want to print all of the output, so here is just the Error message.
** BUILD FAILED **
The following build commands failed:
CompileC osx/build/x86_64-MacOSX/modules/world/OpenCV.build/Release/opencv_world.build/Objects-normal/x86_64/cap_qtkit.o modules/videoio/src/cap_qtkit.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
============================================================
ERROR: Command '['xcodebuild', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '4', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65
============================================================
Traceback (most recent call last):
File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 87, in build
self._build(outdir)
File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 81, in _build
self.buildOne(t[0], t[1], mainBD, cmake_flags)
File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 139, in buildOne
execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir)
File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 34, in execute
retcode = check_call(cmd, cwd = cwd)
File "/Users/christoshadjinikolis/anaconda/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['xcodebuild', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '4', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65
Would appreciate your help. Thanks.
After following the post here I was able to install it just fine by running:
brew install opencv3 --HEAD --with-contrib
The issue appears to be related with the QuickTime codecs. You need to specify that the library is installed with ffmpeg instead and it should work.
brew install opencv3 --with-ffmpeg --with-tbb --with-contrib
Try:
conda create -n opencv python=2
source activate opencv
conda install -c conda-forge opencv==3.1.0
Related
I am following THIS guide to run stable diffusion on my Windows 10 PC that has an AMD GPU. I am having an issue executing the following line in CMD (which I am running as admin):
cd diffusers && git checkout dml && pip install -e .
It results in this error:
C:\AI\Stable Diffusion 2022-10-13 A\Downloaded files>cd diffusers && git checkout dml && pip install -e .
Already on 'dml'
M examples/inference/README.md
Your branch is up to date with 'origin/dml'.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Obtaining file:///C:/AI/Stable%20Diffusion%202022-10-13%20A/Downloaded%20files/diffusers
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\w10b350\appdata\local\programs\python\python35\python.exe' 'c:\users\w10b350\appdata\local\programs\python\python35\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\w10b350\AppData\Local\Temp\tmpg7re1lsb'
cwd: C:\AI\Stable Diffusion 2022-10-13 A\Downloaded files\diffusers
Complete output (19 lines):
Traceback (most recent call last):
File "c:\users\w10b350\appdata\local\programs\python\python35\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "c:\users\w10b350\appdata\local\programs\python\python35\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\users\w10b350\appdata\local\programs\python\python35\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\w10b350\AppData\Local\Temp\pip-build-env-zbv2nary\overlay\Lib\site-packages\setuptools\build_meta.py", line 150, in get_requires_for_build_wheel
config_settings, requirements=['wheel'])
File "C:\Users\w10b350\AppData\Local\Temp\pip-build-env-zbv2nary\overlay\Lib\site-packages\setuptools\build_meta.py", line 130, in _get_build_requires
self.run_setup()
File "C:\Users\w10b350\AppData\Local\Temp\pip-build-env-zbv2nary\overlay\Lib\site-packages\setuptools\build_meta.py", line 254, in run_setup
self).run_setup(setup_script=setup_script)
File "C:\Users\w10b350\AppData\Local\Temp\pip-build-env-zbv2nary\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 148
entries = "\n".join([f' "{k}": "{v}",' for k, v in deps.items()])
^
SyntaxError: invalid syntax
----------------------------------------
WARNING: Discarding file:///C:/AI/Stable%20Diffusion%202022-10-13%20A/Downloaded%20files/diffusers. Command errored out with exit status 1: 'c:\users\w10b350\appdata\local\programs\python\python35\python.exe' 'c:\users\w10b350\appdata\local\programs\python\python35\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\w10b350\AppData\Local\Temp\tmpg7re1lsb' Check the logs for full command output.
ERROR: Command errored out with exit status 1: 'c:\users\w10b350\appdata\local\programs\python\python35\python.exe' 'c:\users\w10b350\appdata\local\programs\python\python35\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\w10b350\AppData\Local\Temp\tmpg7re1lsb' Check the logs for full command output.
C:\AI\Stable Diffusion 2022-10-13 A\Downloaded files\diffusers>
I've installed Python 3.10.8, and completely removed Python 3.5 from "path", pictured below:
A list of PATH environment variables including Python 3.10, but not 3.5
However I still get this error. Additionally "python --version" returns "Python 3.5.0". If I uninstall Python 3.5 completely then the line "cd diffusers && git checkout dml && pip install -e ." doesn't work at all. Restarting Windows did not solve the issue.
I found the solution on Reddit, I'll summarize here for anyone that has the same problem:
Okay, so I didn't realize there are actually two PATHs (a user PATH and system PATH). Also, for some reason, even though I chose to add Python 3.10 to the PATH during installation, it was not added to the system PATH, only the user PATH. I copy-pasted the entries for Python 3.10 from the user PATH to the system PATH. I also deleted all Python 3.5 entries from both PATHs (although that was probably unnecessary). I was then able to follow the rest of the Stable Diffusion guide.
Though, upon trying to generate an image using dml_onnx.py I'm getting another (unrelated) error ("Load model onnx/unet.onnx failed", which probably deserves its own question), so back to the grind I guess.
I'm trying to use pyenv to build & install a universal2 (arm64+intel) python 3.10 on an M1 Mac; I'm running MacOS Monterey 12.3.1. (I need that to use pyinstaller to create universal2 builds.)
I've tried env MACOSX_DEPLOYMENT_TARGET=10.9 CONFIGURE_OPTS="--enable-shared --enable-universalsdk --with-universal=archs=universal2" pyenv install 3.10.3 which I believe is the correct way to do it, but I get this error:
File "/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/Lib/ensurepip/__init__.py", line 193, in _bootstrap
return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
File "/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/Lib/ensurepip/__init__.py", line 93, in _run_pip
return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
File "/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/Lib/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/private/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/python-build.20220509131706.57223/Python-3.10.2/python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/tmpifyf93mk/setuptools-58.1.0-py3-none-any.whl\', \'/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/tmpifyf93mk/pip-21.2.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/var/folders/41/gktcdg9x6d38d7jhzg09nwsh0000gn/T/tmpifyf93mk\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' died with <Signals.SIGABRT: 6>.
I tried various 3.9 versions as well, with the same results.
I'm using homebrew pyenv, and my brew is /opt/homebrew, so M1-based.
Is there a way to use pyenv to get a universal arm/intel python on an M1 machine?
I have a Django application which it's deployed to Elastic Beanstalk, Amazon Linux 2 AMI and I'm very new with AWS. I have to use pythonocc-core package in my application and I cannot install it via pip. If I SSH into an instance and install it manually, it won't be a great way because of autoscaling of EB environment. I added the .config file below for installing anaconda and my deployment was successful.
commands:
00_download_conda:
command: 'wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh'
test: test ! -d /anaconda
01_install_conda:
command: 'bash Anaconda3-2020.02-Linux-x86_64.sh -b -f -p /anaconda'
test: test ! -d /anaconda
02_create_home:
command: 'mkdir -p /home/wsgi'
Deployment failed when I added the following command lines to the continuation of this .config file.
commands:
03_conda_create:
command: conda create --name=whatever-name python=3.7
04_conda_activate:
command: source activate whatever-name
05_conda_install:
command: conda install -c dlr-sc pythonocc-core=7.4.0
But I've got an error such as below.
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 171, in <module>
worklog.build(metadata, configSets)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
self.run_config(config, worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 03_conda_create failed
How can I fix this issue?
A good way would be to use Commands in your .ebextensions folder.
For example, you could have a file .ebextensions/10_install_pythonocc.config:
commands:
10_conda_create:
command: conda create --name=whatever-name python=3.7
20_conda_activate:
command: source activate whatever-name
30_conda_install:
command: conda install -c dlr-sc pythonocc-core=7.4.0
Regarding anaconda itself, here are instructions that can be tried.
Python newbie here. I have encountered a permission problem with anaconda. Everything runs ok, but I do not seem to be able to update conda, create new environments or install new packages.
When I try to update (conda update conda) it I get:
Fetching package metadata ..... An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:
https://github.com/conda/conda/issues
Current conda version:
platform : osx-64
conda version : 4.3.29
conda is private : False
conda-env version : 4.3.29
conda-build version : not installed
python version : 2.7.11.final.0
requests version : 2.14.2
root environment : /anaconda (writable)
default environment : /anaconda
envs directories : /anaconda/Users/Tina/.conda/envs
package cache : /anaconda/Users/Tina/.conda/pkgs
channel URLs : https://conda.anaconda.org/anaconda-fusion/osx-64
https://conda.anaconda.org/anaconda-fusion/noarch
https://repo.continuum.io/pkgs/main/osx-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/osx-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/osx-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/osx-64
https://repo.continuum.io/pkgs/pro/noarch
config file : /Users/Tina/.condarc
netrc file : None
offline mode : False
user-agent : conda/4.3.29 requests/2.14.2 CPython/2.7.11 Darwin/15.5.0 OSX/10.11.5
UID:GID : 501:20
$ /anaconda/bin/conda update conda
Traceback (most recent call last):
File "/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 640, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 140, in _main
exit_code = args.func(args, p)
File "/anaconda/lib/python2.7/site-packages/conda/cli/main_update.py", line 65, in execute
install(args, parser, 'update')
File "/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 231, in install
unknown=index_args['unknown'], prefix=prefix)
File "/anaconda/lib/python2.7/site-packages/conda/core/index.py", line 101, in get_index
index = fetch_index(channel_priority_map, use_cache=use_cache)
File "/anaconda/lib/python2.7/site-packages/conda/core/index.py", line 120, in fetch_index
repodatas = collect_all_repodata(use_cache, tasks)
File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 75, in collect_all_repodata
repodatas = _collect_repodatas_serial(use_cache, tasks)
File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 485, in _collect_repodatas_serial
for url, schan, pri in tasks]
File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 115, in func
res = f(*args, **kwargs)
File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 467, in fetch_repodata
touch(cache_path)
File "/anaconda/lib/python2.7/site-packages/conda/gateways/disk/update.py", line 64, in touch
utime(path, None)
OSError: [Errno 13] Permission denied: '/anaconda/pkgs/cache/9cd9d6b5.json'```
I get the same error when trying to install seaborn or creating an environment. I am reluctant to use sudo because I do not want to break things.
I do not understand what is going on here, so any help would be highly appreciated.
Thanks so much;
T
The user that you are using to run conda update conda does not have write permission on /anaconda/pkgs/cache/.
If you don't want to manage anaconda as the superuser, I would recommend that you create a new user group (i.e. anaconda_admin) and run:
sudo groupadd anaconda_admin
sudo chown -R :anaconda_admin /anaconda
Then you will need to ensure that permissions are something like:
sudo chmod -R 775 /anaconda
And finally that your user is in the anaconda_admin group:
sudo adduser <<<your_user>>> anaconda_admin
For humble Windows users that cannot use sudo: You have to open the conda console as Administrator by right clicking on the console icon and then select run as administrator. Then conda update conda should work fine.
You ought to use sudo in order to write certain files into system. It is perfectly fine and will not break you OS, unless you work with sophisticated and rudimentary packages and installers (conda and python libraries are absolutely fine).
sudo conda update conda should do the thing not only with updating conda, but also with other dependencies and packages you wish to install.
In short, the installer tries to write a file into a certain directory (or modify a file in a directory) that it has not got an access to. With sudo you make them do that as you run it with appended priviliges.
On RedHat Enterprise 7, trying to install node.js inside of a nodeenv (0.13.6) in a Python virtual environment (Python 2.7). When I do nodeenv -p, I get OSError: Command make --jobs=2 failed with error code 2...googling, the only reference to this is here. Not super useful for me, because I am already trying to install the newest version of node (4.2.1). Full trace of this is below:
$ nodeenv -p
* Install node (4.2.1..Traceback (most recent call last):
File "/usr/local/pythonenvs/producer/bin/nodeenv", line 11, in <module>
sys.exit(main())
File "/usr/local/pythonenvs/producer/lib/python2.7/site-packages/nodeenv.py", line 891, in main
create_environment(env_dir, opt)
File "/usr/local/pythonenvs/producer/lib/python2.7/site-packages/nodeenv.py", line 732, in create_environment
install_node(env_dir, src_dir, opt)
File "/usr/local/pythonenvs/producer/lib/python2.7/site-packages/nodeenv.py", line 608, in install_node
build_node_from_src(env_dir, src_dir, node_src_dir, opt)
File "/usr/local/pythonenvs/producer/lib/python2.7/site-packages/nodeenv.py", line 577, in build_node_from_src
callit([make_cmd] + make_opts, opt.verbose, True, node_src_dir, env)
File "/usr/local/pythonenvs/producer/lib/python2.7/site-packages/nodeenv.py", line 461, in callit
% (cmd_desc, proc.returncode))
OSError: Command make --jobs=2 failed with error code 2
I then tried to install from prebuilt, using the instructions in this GitHub issue.
nodeenv -p --prebuilt
That seemed to work...
* Install node (4.2.1... done.
* Appending data to /usr/local/pythonenvs/producer/bin/activate
Except nothing actually installed -- tab completing shows no node or npm install (I have deactivated and re-activated the virtual environment):
$ no
nodeenv nohup nologin notify-send
$ np
$ nproc
My other installs worked with the same instructions, so I'm at a loss for debugging this. Any hints or suggestions? If this is a permissions issue, where do I need to set / change them? The user already owns the virtual environment directory...
Okay, so I don't have a solution to the root cause (I suspect some sort of issue / conflict with make on my server), but I managed to get it installed via --prebuilt. I had to manually delete the node.js source from /usr/local/pythonenvs/producer/src/node-v4.2.1/, because the --prebuilt option was trying to copy those as if they were binaries. After deleting the directory, I downloaded / extracted from nodejs.org into the virtual environment's src directory. Then, the nodeenv -p --prebuilt command works fine.