1
votes

Unfortunately I deleted some files of Python. I got macOS Catalina and I want to install pytorch with the command:

pip3 install torch

If I enter this in my terminal I'll get

Building wheel for torch (setup.py) ... error ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"'; file='"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-wheel-qh35w11o --python-tag cp38 cwd: /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/ Complete output (30 lines): running bdist_wheel running build running build_deps Traceback (most recent call last): File "", line 1, in File "/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py", line 225, in setup(name="torch", version="0.1.2.post2", File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/init.py", line 145, in setup return distutils.core.setup(**attrs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 192, in run self.run_command('build') File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py", line 51, in run from tools.nnwrap import generate_wrappers as generate_nn_wrappers ModuleNotFoundError: No module named 'tools.nnwrap'


ERROR: Failed building wheel for torch Running setup.py clean for torch ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"'; file='"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all cwd: /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch Complete output (2 lines): running clean error: [Errno 2] No such file or directory: '.gitignore'


ERROR: Failed cleaning build dir for torch Failed to build torch Installing collected packages: torch Running setup.py install for torch ... error ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"'; file='"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-record-cerpeh7h/install-record.txt --single-version-externally-managed --compile cwd: /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/ Complete output (23 lines): running install running build_deps Traceback (most recent call last): File "", line 1, in File "/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py", line 225, in setup(name="torch", version="0.1.2.post2", File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/init.py", line 145, in setup return distutils.core.setup(**attrs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py", line 99, in run self.run_command('build_deps') File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py", line 51, in run from tools.nnwrap import generate_wrappers as generate_nn_wrappers ModuleNotFoundError: No module named 'tools.nnwrap' ---------------------------------------- ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"'; file='"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-kb_zrdjk/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-record-cerpeh7h/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Is there a way to solve this problem? Do you need further Information?

UPDATE

I changed the way of the enviroment (without anaconda) and so I get this error message:

ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-zelcwulm/torch/setup.py'"'"'; file='"'"'/private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-install-zelcwulm/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/sb/4h99w30940zcbdvy_csrksxc0000gn/T/pip-record-i1_7akf_/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

1

1 Answers

0
votes

Try running:

pip3 install --upgrade --force-reinstall pip

If that doesn't work you can always try reinstalling python from https://www.python.org/downloads