Error while creating virtual environment in Python3.8 - python

virtualenv myvirtualenv
I am new to the virtual environment in Python. I was following this tutorial https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/
But got stuck in step 3
The Error I got:
Traceback (most recent call last):
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\via_app_data.py", line 58, in _install
installer.install(creator.interpreter.version_info)
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 46, in install
for name, module in self._console_scripts.items():
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 116, in _console_scripts
entry_points = self._dist_info / "entry_points.txt"
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 103, in _dist_info
raise RuntimeError(msg) # pragma: no cover
RuntimeError: no .dist-info at C:\Users\Vivek\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\setuptools-50.3.1-py3-none-any, has distutils-precedence.pth, easy_install.py, pkg_resources, setuptools, _distutils_hack
Traceback (most recent call last):
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\via_app_data.py", line 58, in _install
installer.install(creator.interpreter.version_info)
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 46, in install
for name, module in self._console_scripts.items():
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 116, in _console_scripts
entry_points = self._dist_info / "entry_points.txt"
File "c:\users\vivek\appdata\local\programs\python\python38-32\lib\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 103, in _dist_info
raise RuntimeError(msg) # pragma: no cover
RuntimeError: no .dist-info at C:\Users\Vivek\AppData\Local\pypa\virtualenv\wheel\3.8\image\1\CopyPipInstall\pip-20.2.3-py2.py3-none-any, has pip```
Thanks in advance

you don't need to use virtualenv package in python 3.3 or above. There is a built in solution in these versions.
Just run the following command:
python -m venv myvirtualenv
It will create a new virtualenv named "myvirtualenv".

Try the following-
virtualenv -p python3 myvirtualenv

Related

TypeError from pip when setting up virtualenv

new to coding and I think I've searched thoroughly for answers to this question, but the suggested solutions haven't been working for me. Apologies if this is a duplicate, though!
I'm trying to set up my computer according to these instructions, currently trying to get virtualenv up and running. However, pip doesn't seem to be working properly. I was able to use python -m pip as a workaround and installed virtualenv using: python -m pip install virtualenv
But the same workaround doesn't seem to work with virtualenvwrapper: python -m pip install virtualenvwrapper gives me this error:
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/Library/Python/2.7/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
If I try running anything directly with a pip command, such as pip install virtualenvwrapper, I get this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
I have a mac running Sierra (10.12.4). Python version 2.7.6. Pip 9.0.1
Thoughts? Thank you!

Installing pip for arcpy

I'm attempting to install pip for arcpy (arcgis 10.2 on windows 7). Running get-pip.py results in the following error message:
X:\python>python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 20061, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "c:\temp\tmpou5fje\pip.zip\pip\__init__.py", line 26, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\utils\__init__.py", line 27, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\_vendor\pkg_resources\__init__.py", line 73, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\_vendor\packaging\specifiers.py", line 275, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\_vendor\packaging\specifiers.py", line 373, in Specifier
File "C:\Python27\ArcGIS10.2\Lib\re.py", line 190, in compile
return _compile(pattern, flags)
File "C:\Python27\ArcGIS10.2\Lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
Using an administrator command prompt doesn't help. My real goal is to get win32com working under arcpy. I usual just copy the appropriate directories out of c:\python27\lib\site-packages to c:\python27\arcgis10.2\lib\site-packages to install a package under arcpy (why doesn't arcpy come with pip?) but that's not working for win32com, presumably do to a missing dll or other windows specific file.
I would recommend the following:
Get the setuptools module
Get the pip module`
And then run the following in command line (assuming windows)
path-to-python path-to-setuptools install
path-to-python path-to-pip install
I work on a closed network (away from the interwebs of old) and cannot use get-pip.py so I find it best to simply download the actual modules and hard install.
Keep us posted!
Copy get_pip.py to "C:\Python27\ArcGIS10.2", then perform command "python get-pip.py" in the directory.
Note that keep network connected in the process, so that auto-download and setup setuptools,wheels,etc.
Hope that can help you.
Try opening a CMD prompt and typing:
C:\Python27\ArcGIS10.2\python.exe -m pip install -U pip

Unable to install Flask-Mail

I am trying to send an email using Flask when a user registers on my website. I used the command pip install Flask-Mail to install. However, I get the following error of possible version mismatch:
Downloading/unpacking Flask-mail
Downloading Flask-Mail-0.9.1.tar.gz (45kB): 45kB downloaded
Running setup.py (path:/tmp/pip_build_root/Flask-mail/setup.py) egg_info for package Flask-mail
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/Flask-mail/setup.py", line 52, in <module>
'Topic :: Software Development :: Libraries :: Python Modules'
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require
working_set.resolve(self.dist.requires(self.extras),env,installer))
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/Flask-mail/setup.py", line 52, in <module>
'Topic :: Software Development :: Libraries :: Python Modules'
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require
working_set.resolve(self.dist.requires(self.extras),env,installer))
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/Flask-mail
Any possible workarounds? Any help will be greatly appreciated. Thanks!
The easiest way to avoid these kind of problems is to create a virtual environment
>>>pip install virtualenv
>>>cd my_project_folder
>>>virtualenv venv
now activate your virtual environment
>>>source venv/bin/activate
now install there pip install Flask-Mail
hopefully now it should work there
if your done working then deactivate it
>>>deactivate
or
It seems like all the problem is because of certifi version conflict
so try downloading the source from here
https://pypi.python.org/pypi/certifi
and install from source
Extract it go into the folder and run this command
sudo python setup.py install
and it should work
peace
If you do not have virtual env set up I would suggest do so first. If you have that already you may need to activate that from your terminal:
>>>source venv/bin/activate
Once completed just deactivate it for your rest of the commands:
>>>deactivate

Fail to open up Scrapy on Linux Ubuntu

I've been getting error bringing up Scrapy on my Linux box. I'm using Ubuntu 14.0 Desktop. I've installed setuptools and scrapy. For some reason when I put
scrapy --version
I get this error:
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 122, in execute
cmds = _get_commands_dict(settings, inproject)
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 46, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 29, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 20, in _iter_command_classes
for module in walk_modules(module_name):
File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/misc.py", line 68, in walk_modules
submod = import_module(fullpath)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/bench.py", line 2, in <module>
from scrapy.tests.spiders import FollowAllSpider
ImportError: No module named tests.spiders
Any Idea what would this be from?
There was an issue with build 0.24.3 commited on Github.
To solve your problem just type this in terminal:
sudo pip install scrapy --upgrade
This will upgrade your version of Scrapy to 0.24.4.
Referring to the stackoverflow.com/q/25218633/190597. That will fix the issue. Or at least in my case.
Try uninstalling the old version of scrapy with:
pip uninstall Scrapy
and then installing it again using pip with this command:
pip install scrapy==0.24.2
well do not forget to install python development packages beforehand. That will raise another issue if not installed properly.

Why can't I install the openstack nova client on OS X?

I am attempting to install the openstack nova client on my Mac (10.4.8)
nova = https://github.com/openstack/python-novaclient#command-line-api
python --version
Python 2.7.2
I successfully got nova installed (after installing pip)
When I run the client, I get the following error
foo#bar-macbook-pro:~$ nova
Traceback (most recent call last):
File "/usr/local/bin/nova", line 6, in <module>
from novaclient.shell import main
File "/Library/Python/2.7/site-packages/novaclient/__init__.py", line 15, in <module>
import pbr.version
ImportError: No module named pbr.version
In my research, I have found conflicting information about pbr, some say it is required for nova, while others say it isn't required for nova.
https://github.com/rackspace/pyrax/issues/121
When I attempt to install pbr, I see the following error.
foo#bar-macbook-pro:~$ sudo python ~/Downloads/pbr/setup.py install
Traceback (most recent call last):
File "setup.py", line 22, in <module>
**util.cfg_to_args())
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/util.py", line 241, in cfg_to_args
pbr.hooks.setup_hook(config)
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/__init__.py", line 27, in setup_hook
metadata_config.run()
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/base.py", line 29, in run
self.hook()
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/metadata.py", line 28, in hook
self.config['name'], self.config.get('version', None))
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 817, in get_version
version = _get_version_from_git(pre_version)
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 776, in _get_version_from_git
"git --git-dir=\"" + git_dir + "\" describe --always").replace(
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 220, in _run_shell_command
stderr=err_location)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
TypeError: must be encoded string without NULL bytes, not str
Is there anything apparent that would explain why I can not get the library installed?
Surely I must not be the first person to try and install nova on OS X.
Over a year later, I finally got this working on OS X Yosemite
sudo pip install python-novaclient
I did not have to install pbr.
I did the install based on venv:
virtualenv venv_name
source venv_name/bin/activate
pip install python-novaclient fabric
In my case, I had a mixup in which python I was using by way of fabric being installed globally.
Prior: rf -rf all my virtualenvs, rf -rf all references to novaclient (locally, and globally), and deleted a global install of fabric which was calling the novaclient.
Also as a precaution, I do not install pip globally, and only use it without sudo in virtualenvs.

Categories

Resources