I use python36 and win10, I can install virtualenv successfully. But when I want to activate it, some mistakes have occurred.
$pip install virtualenv
Requirement already satisfied: virtualenv in c:\users\appdata\local\programs\python\python36\lib\site-packages
$virtualenv venv
Using base prefix 'c:\\users\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Users\myvenv\venv\Scripts\python.exe
Installing setuptools, pip, wheel...
Complete output from command C:\Users\myvenv\venv\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ModuleNotFoundError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "c:\users\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\AppData\Local\Programs\Python\Python36\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 713, in main
symlink=options.symlink)
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 945, in create_environment
download=download,
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command C:\Users\myvenv\venv\Scripts\python.exe - setuptools pip wheel failed with error code 1
Why is there such a problem?
In fact, you don't need to reinstall your python, instead, you can just entry virtualenv envname --no-setuptools --no-pip --no-wheel in your cmd line, hope be helpful.
Related
After upgrading pip on python3.5 I am getting the message
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 57 sys.stderr.write(f"ERROR: {exc}")
I tried the solution in
pip: sys.stderr.write(f"ERROR: {exc}") with Python 3.5
However when I try
sudo curl -fsSL https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3.5
I get
/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py:18:
UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.`
`"Distutils was imported before Setuptools, but importing Setuptools "
/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Traceback (most recent call last):
File "<stdin>", line 23974, in <module>
File "<stdin>", line 199, in main
File "<stdin>", line 121, in bootstrap
File "/usr/local/lib/python3.5/dist-packages/setuptools/__init__.py", line 8, in <module>
import _distutils_hack.override # noqa: F401
File "/usr/local/lib/python3.5/dist-packages/_distutils_hack/override.py", line 1, in
<module>
__import__('_distutils_hack').do_override()
File "/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py", line 72, in do_override
ensure_local_distutils()
File "/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py", line 59, in ensure_local_distutils
assert '_distutils' in core.__file__, core.__file__
AssertionError: /usr/lib/python3.5/distutils/core.py ```
Any ideas?
SOLVED: the solution was I needed zlib1g-dev
This is the error pyenv produces
Traceback (most recent call last):
File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 568, in _get_data
File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/runpy.py", line 206, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/ensurepip/__init__.py", line 210, in _main
return _bootstrap(
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/ensurepip/__init__.py", line 129, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/ensurepip/__init__.py", line 38, in _run_pip
return subprocess.run([sys.executable, "-c", code], check=True).returncode
File "/tmp/python-build.20201212114143.1082/Python-3.9.0/Lib/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20201212114143.1082/Python-3.9.0/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpk898xfhs/setuptools-49.2.1-py3-none-any.whl\', \'/tmp/tmpk898xfhs/pip-20.2.3-py2.py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpk898xfhs\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1254: install] Error 1
I have found nothing on this when googling and have no idea what is going on.
the steps that I have done are, first installing the pyenv installer and running that script then trying to run (pyenv install -v 3.9.0)
the system does have python3.8 installed and pyenv does seem to know about it
but it still will not let me install 3.9.0
EDIT: I should also throw in that in order to let pyenv know about the system version of python I did this (sudo ln -s /usr/bin/python3 /usr/bin/python).
Another thing is I also tried installing 3.9.0 with a tool called asdf and that resulted in the same error
EDIT2: It seems like im missing zlib from the traceback but Im on ubuntu and do have zlib1g installed and from what I looked up thats what zlib is on ubuntu 20.04 im going to try and find more info on the zlib and see if I need to install something else
I had a similar problem trying to install Python 3.8 with asdf (which uses the same backend as pyenv) on WSL2/Ubutnu18, and installing zlib1g-dev was not enough to solve it as stated by the question's author.
Therefore, as a more general solution, I have found that installing all dependencies recommended by pyenv for Ubuntu did solve the problem for asdf (and I suspect for pyenv as well). The dependencies for different OS can be found here: https://github.com/pyenv/pyenv/wiki#suggested-build-environment
I hope this is useful for others!
PS: This resource might be useful as well for similar issues: https://github.com/pyenv/pyenv/wiki/Common-build-problems
I have installed pyforest with :
pip install --upgrade pyforest
It worked well, but when I run on terminal :
python -m pyforest install_extensions
I have this output :
Starting to install pyforest extensions for Jupyter Notebook and Jupyter Lab
Trying to install pyforest nbextension...
Traceback (most recent call last):
File "/home/bled/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/bled/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/bled/anaconda3/lib/python3.7/site-packages/pyforest/main.py", line 15, in
install_extensions()
File "/home/bled/anaconda3/lib/python3.7/site-packages/pyforest/utils.py", line 19, in install_extensions
install_nbextension()
File "/home/bled/anaconda3/lib/python3.7/site-packages/pyforest/utils.py", line 38, in install_nbextension
nbextensions.install_nbextension_python("pyforest")
File "/home/bled/anaconda3/lib/python3.7/site-packages/notebook/nbextensions.py", line 225, in install_nbextension_python
destination=dest, logger=logger
File "/home/bled/anaconda3/lib/python3.7/site-packages/notebook/nbextensions.py", line 126, in install_nbextension
ensure_dir_exists(nbext)
File "/home/bled/anaconda3/lib/python3.7/site-packages/jupyter_core/utils/init.py", line 13, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/home/bled/anaconda3/lib/python3.7/os.py", line 211, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/home/bled/anaconda3/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter'
I have tried :
python -m pyforest install_extensions --user
But it doesn't work either and instead gives the following output:
Usage: python -m pyforest install_extensions installs notebook/lab
extensions
Can somone please help?
'python -m pyforest install_extensions' run this command on anaconda prompt not on terminal. There is another way we can install the extensions directly from jupyter notebook. These are the commands to follow
import pyforest
pyforest.install_nbextension()
pyforest.install_labextension()
I got the following error when I try to install scipy with pip3 on Mac OS X 10.14.1. Does anybody know what the problem is? I was able to install scipy with pip2.
$ pip3 install scipy
Collecting scipy
Using cached https://files.pythonhosted.org/packages/ee/5b/5afcd1c46f97b3c2ac3489dbc95d6ca28eacf8e3634e51f495da68d97f0f/scipy-1.3.1.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/mktemp/tmp9rjyv64p
cwd: /private/tmp/mktemp/pip-install-w63x23dy/scipy
Complete output (50 lines):
setup.py:386: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/tmp/mktemp/pip-install-w63x23dy/scipy/pip-wheel-metadata'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Traceback (most recent call last):
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: dlopen(/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/multiarray.cpython-38m-darwin.so, 2): Symbol not found: _aheapsort_bool
Referenced from: /private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/multiarray.cpython-38m-darwin.so
Expected in: flat namespace
in /private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/multiarray.cpython-38m-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 69, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
self.run_setup()
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 236, in run_setup
super(_BuildMetaLegacyBackend,
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 505, in <module>
setup_package()
File "setup.py", line 481, in setup_package
from numpy.distutils.core import setup
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: dlopen(/private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/multiarray.cpython-38m-darwin.so, 2): Symbol not found: _aheapsort_bool
Referenced from: /private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/multiarray.cpython-38m-darwin.so
Expected in: flat namespace
in /private/tmp/mktemp/pip-build-env-4kdqsfzb/overlay/lib/python3.8/site-packages/numpy/core/multiarray.cpython-38m-darwin.so
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/mktemp/tmp9rjyv64p Check the logs for full command output.
WARNING: You are using pip version 19.2.2, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I was setting up virtualenvwrapper-win and was trying to create a virtual environment using, mkvirtualenv py3env1 and the process hangs at Installing setuptools, pip, wheel...
At Keyboard interrupt it shows some errors.
I have tried to install as below
virtualenv venv --no-wheel
it hangs in the same place
C:\virtualenvs>mkvirtualenv pytorch1
Using base prefix 'c:\\python37'
New python executable in C:\virtualenvs\pytorch1\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Traceback (most recent call last):
File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python37\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "c:\python37\lib\site-packages\virtualenv.py", line 834, in main
symlink=options.symlink,
File "c:\python37\lib\site-packages\virtualenv.py", line 1129, in create_environment
install_wheel(to_install, py_executable, search_dirs, download=download)
File "c:\python37\lib\site-packages\virtualenv.py", line 976, in install_wheel
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "c:\python37\lib\site-packages\virtualenv.py", line 1066, in _install_wheel_with_search_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File "c:\python37\lib\site-packages\virtualenv.py", line 901, in call_subprocess
line = stdout.readline()
KeyboardInterrupt
Terminate batch job (Y/N)? Y