Error when trying to create virtualenv - python

I can't create a new virtual environment because of the following error:
$ virtualenv env
New python executable in env/bin/python
Installing distribute....done.
Complete output from command /var/www/vhosts/example.com/...ython /var/www/vhosts/example.com/...stall /usr/lib/pymodules/python2.6/v...ar.gz:
error: Not a URL, existing file, or requirement spec: '/usr/lib/pymodules/python2.6/virtualenv_support/pip-0.6.3.tar.gz'
----------------------------------------
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.4.5', 'console_scripts', 'virtualenv')()
File "/usr/lib/pymodules/python2.6/virtualenv.py", line 537, in main
use_setuptools=options.use_setuptools)
File "/usr/lib/pymodules/python2.6/virtualenv.py", line 630, in create_environment
install_pip(py_executable)
File "/usr/lib/pymodules/python2.6/virtualenv.py", line 390, in install_pip
filter_stdout=_filter_setup)
File "/usr/lib/pymodules/python2.6/virtualenv.py", line 598, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /var/www/vhosts/example.com/...ython /var/www/vhosts/example.com/...stall /usr/lib/pymodules/python2.6/v...ar.gz failed with error code 1
I have already searched the web but couldn't find any solution to this problem. I'm using Ubuntu 10.04.4 LTS with Python 2.6.5 and Virtualenv 1.7.2, any help appreciated. :)

I just figured it out myself: I tried to install virtualenv with apt-get install python-virtualenv.
Executing apt-get purge python-virtualenv && easy_install virtualenv solved the problem.

I'm seeing the same issue, and I did install "python-virtualenv" via "easy_install" instead of "apt-get".

Related

can't launch tensorboard from mac terminal

problem: I can't run "tensorboard --logdir=summaries" in my terminal because I get this error
system: macbook pro running Catalina
environment: running pyenv with python3 as global
package: I have tensorflow 2.2.0 installed via pip
I have setuptools 49.1.0
Traceback (most recent call last):
File "/usr/local/bin/tensorboard", line 10, in
sys.exit(run_main())
File "/Library/Python/3.7/site-packages/tensorboard/main.py", line 65, in run_main
default.get_plugins() + default.get_dynamic_plugins(),
File "/Library/Python/3.7/site-packages/tensorboard/default.py", line 125, in get_dynamic_plugins
"tensorboard_plugins"
File "/Library/Python/3.7/site-packages/tensorboard/default.py", line 124, in
for entry_point in pkg_resources.iter_entry_points(
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2410, in load
self.require(*args, **kwargs)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2433, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (setuptools 40.8.0 (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages), Requirement.parse('setuptools>=41.0.0'))
the setuptools version you have is 40.8.0.
tensorboard needs setuptools>=41.0.0.
So there are two solutions:
update setuptools to >=41.0.0
create a new environment with setuptools>=41.0.0.
MacOs may not allow you to update setuptools, due to system integrity protection
Adding --user python to the command allowed this to work.
In other words
pip install --upgrade setuptools --user python
As it turns out I was not using Pyenv correctly. Once I used "pyenv global system" then I was able to update the pip packages correctly and the right setuptools was installed and TensorBoard ran as expected

Python-pip : Invoice2data package installation error through pip

I am trying to install invoice2data package through pip but i am getting the following error :
ERROR: Exception: Traceback (most recent call last): File
"/home/webwerks/.local/lib/python2.7/site-packages/pip/_internal/cli/base_command.py",
line 178, in main status = self.run(options, args) File
"/home/webwerks/.local/lib/python2.7/site-packages/pip/_internal/commands/install.py",
line 414, in run use_user_site=options.use_user_site, File
"/home/webwerks/.local/lib/python2.7/site-packages/pip/_internal/req/__init__.py",
line 58, in install_given_reqs
**kwargs File "/home/webwerks/.local/lib/python2.7/site-packages/pip/_internal/req/req_install.py",
line 922, in install use_user_site=use_user_site, pycompile=pycompile,
File
"/home/webwerks/.local/lib/python2.7/site-packages/pip/_internal/req/req_install.py",
line 448, in move_wheel_files
warn_script_location=warn_script_location, File
"/home/webwerks/.local/lib/python2.7/site-packages/pip/_internal/wheel.py",
line 428, in move_wheel_files assert info_dir, "%s .dist-info
directory not found" % req AssertionError: invoice2data .dist-info
directory not found
Ubuntu : 16.04
python : Python 2.7.12
pip : pip 19.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
I have tried uninstalling pip completely and then reinstalling again still I get the same error. Also tried other StackOverflow solutions but still it didn't help.
i tried the command in python 3.7.2 and it was installed succesfully. This is the command used
"python -m pip install invoice2data"

Unable to create virtual environment

I am unable to create virtual environment using both Python 2.x or Python 3.x. When I try create virtual environment I get error:
$ virtualenv my_env2 [0:05:17] ⚡[..........]
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/user/my_env2/bin/python2
Not overwriting existing python script /home/user/my_env2/bin/python (you must use /home/user/my_env2/bin/python2)
Installing setuptools, pkg_resources, pip, wheel...
Complete output from command /home/lynx/my_env2/bin/python2 - setuptools pkg_resources pip wheel:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 31, in <module>
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 40, in <module>
ImportError: cannot import name requests
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
main()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment
download=download,
File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/user/my_env2/bin/python2 - setuptools pkg_resources pip wheel failed with error code 1
The same error occurs for Python 3.x. Can you help me?
I had a similar problem when trying to do this with Python3. Try this command:
sudo python3 -m <your virtual env name>
First, make a directory of any name :
mkdir testing
Then, moved to this newly created directory named testing :
cd testing
When you type following command in this directory:
python3 -m venv env
You got error like :
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.8-venv
Type the following command but before that keep an eye on the version of python you installed on the machine; in my case its python3.8
sudo apt install python3.8-venv
Now, we can create a virtual environment and store its tools in the "bhandari" folder .
python3 -m venv bhandari
Note: you can named this "bhandari" folder; anyname you like( Standard practice is to name it "env" ...)
Now to activate your virtual environment, from the directory of your folder, type the following command this will activate our virtual environment in the “bhandari” folder
source bhandari/bin/activate
If you have successfully activated your virtual environment, you should see the (bhandari) word indicating that we are working in a virtual environment.
After this, we can install anything that will be isolated from the rest of the system....

Error after installing EB CLI 3.x

I am trying to install the elastic beanstalk CLI on an EC2 instance (running AMI) using these instructions:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-getting-started.html
I have python 2.7.9 installed, pip and eb. However, when I try to run eb I get the error below. It looks like it is still using python 2.6. How do you fix that?
Thanks!
Traceback (most recent call last):
File "/usr/bin/eb", line 9, in <module>
load_entry_point('awsebcli==3.0.10', 'console_scripts', 'eb')()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2568, in load_entry_point
return ep.load()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2259, in load
['__name__'])
File "/usr/lib/python2.6/site-packages/ebcli/core/ebcore.py", line 23, in <module>
from ..controllers.initialize import InitController
File "/usr/lib/python2.6/site-packages/ebcli/controllers/initialize.py", line 16, in <module>
from ..core.abstractcontroller import AbstractBaseController
File "/usr/lib/python2.6/site-packages/ebcli/core/abstractcontroller.py", line 21, in <module>
from ..core import io, fileoperations, operations
File "/usr/lib/python2.6/site-packages/ebcli/core/operations.py", line 762
vars = {n['OptionName']: n['Value'] for n in settings
^
SyntaxError: invalid syntax
Pip is probably set up with Python 2.6 instead of python 2.7.
pip --version
You can reinstall pip with Python 2.7, then reinstall 2.6
pip uninstall awsebcli
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install awsebcli
I had the same problem, the fix for me was actually to upgrade to latest Beanstalk stack ( eb upgrade ). Note there are downtime etc. So investigate if you can run the latest stack before upgrading.
The "smartest" solution for me was to install python-dev tools
sudo apt install python-dev
found here:
http://ericbenson.azurewebsites.net/deployment-on-aws-elastic-beanstalk-for-ubuntu/

mac osx: unable to use virtualenv

I'm trying to create an environment using virtualenv.
virtualenv test
New python executable in test/bin/python
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Fram.../Versions/2.6/Python #executable_path/../.Python test/bin/python
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.6.4', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 810, in main
never_download=options.never_download)
File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 901, in create_environment
site_packages=site_packages, clear=clear))
File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 1166, in install_python
py_executable])
File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 843, in call_subprocess
cwd=cwd, env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
OSError: [Errno 2] No such file or directory
Folder is created alright, but files like activate are missing. Anyone? (I have xcode 3.2.3 installed. running python 2.6, osx 10.6.8)
Your developer tools are not installed correctly. I recommend installing Xcode 4.
I had the same error messages trying to run virtualenv on a up-to-date Max OS X Lion (10.7.2) installation with XCode installed and very up-to-date using the App Store.
I missed the /usr/bin/install_name_tool as well, however it is there in the system. Use the terminal in the following code blocks.
$ locate install_name_tool
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/install_name_tool
/Developer/usr/bin/install_name_tool
/Developer/usr/share/man/man1/install_name_tool.1
I made a simlink from the /Developer/usr/bin to the /usr/bin with
$ sudo ln -s /Developer/usr/bin/install_name_tool /usr/bin/install_name_tool
Entering the 'which' command yields:
$ which install_name_tool
/usr/bin/install_name_tool
After that I did the virtualenv magic
$ virtualenv -p python2.6 myvirtenv
Running virtualenv with interpreter /opt/local/bin/python2.6
New python executable in myvirtenv/bin/python
Installing setuptools............................done.
Installing pip...............done.
Works like a charm now!
Use install_name_tool from #gregglind's fork of virtualenv:
git clone https://github.com/gregglind/virtualenv.git
cd virtualenv
git checkout feature/install_name_tool
sudo python setup.py install
Credits: macdhuibh (https://github.com/pypa/virtualenv/issues/7)
Get the XCode Command line tools from here:
https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-#
I just fresh installed Lion, and installed XCode from the App Store - and these didn't get installed at the same time, need a separate install now I guess...

Categories

Resources