I have Django 1.9.7 installed, and its works fine, but every time I open the terminal, I get this message.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
When I startproject in Django, it works fine. I wonder whether this will cause problems in the future, and how can I fix it?
I speculate that it is causing this problem because I used to use Python 2.7 with Django 1.9.7. I have recently upgrade by python to 2.4, but it seems that my packages for python 2.7 still exist in my computer. However, when I tried removing the python 2.7 packages with pip uninstall python == 2.7, I get this error
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 336, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/f7/jrgwm7ms037f4v9lydh4cjcr0000gn/T/pip-dSXtam-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/Python-2.7.10-py2.7.egg-info'
I have read that it is not good to uninstall packages using pip because it does uninstall everything, but I am not sure how else to do it, and I am not sure how to fix the module issue either.
Related
I have a program where I dearly need the dependency list, but pip freeze isn't working. I am running CentOS 7 and Python 2.7.5
The program runs on Python 2.4 (which I am doing as an alias in another terminal, yes, I did try the pip freeze from that terminal) and fortran95. I definitely have pip installed. I tried upgrading the Python2.7, but it says it is fine.
The the error from pip is as follows.
[root#localhost rotate6]# pip freeze
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/freeze.py", line 85, in run
for line in freeze(**freeze_kwargs):
File "/usr/lib/python2.7/site-packages/pip/operations/freeze.py", line 47, in freeze
dependency_links
File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 264, in from_dist
req = dist.as_requirement()
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2562, in as_requirement
return Requirement.parse(spec)
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2833, in parse
req, = parse_requirements(s)
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2781, in parse_requirements
yield Requirement(line)
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2790, in __init__
raise RequirementParseError(str(e))
RequirementParseError: Invalid requirement, parse error at "'-ipap11h'"
This is a known issue. See https://github.com/pypa/pip/issues/3764
The advice there is to try downgrading your version of pip to one that is less strict (some people find 8.1.0 works), or to uninstall the offending package, which appears to be _ipap11helper.
So I'm running Python 2.7.11 and am trying to install pip. I thought pip was already installed on Python 2 >= 2.7.9, but I guess I was wrong. Whenever I try to run get-pip.py, I get:
`Traceback (most recent call last):
File "get-pip.py", line 19177, 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:\users\user\appdata\local\temp\tmp41xybl\pip.zip\pip\__init__.py", line 14, in <module>
File "c:\users\user\appdata\local\temp\tmp41xybl\pip.zip\pip\utils\__init__.py", line 23, in <module>
File "c:\users\user\appdata\local\temp\tmp41xybl\pip.zip\pip\locations.py", line 120, in <module>
File "c:\users\user\appdata\local\temp\tmp41xybl\pip.zip\pip\utils\appdirs.py", line 150, in site_config_dirs
File "c:\users\user\appdata\local\temp\tmp41xybl\pip.zip\pip\utils\appdirs.py", line 191, in _get_win_folder_from_registry
WindowsError: [Error 2] The system cannot find the file specified`
I really don't know what I'm doing wrong, and there aren't any helpful answers online. Can someone help me understand what I need to do to fix this and get pip installed? Thanks.
I have been using ipython and also a little bit of jupyter for quite some time, some time ago. After not having used it in almost 6 months I wanted to start using it again.
I installed the newest version of jupyter, updated my python 2.7 install, got pip working and installed the necessary packages:
pip install jupyter
pip install notebook
and etc. After having done that I tried to enter an old notebook (written in 2.7) but there was no connection to the kernel. I thought, well wth, why not just update to the newest python 3 version and try that. That resulted in the same problem.
I went ahead and installed anaconda and created two virtual envs, one with python 2.7 and one with python 3.5. Both installed like this:
conda create --name py27 python=2.7 anaconda
conda create --name py35 python=3.5 anaconda
After that I made sure that both venvs had jupyter installed by activating them and trying to install the package. (This was done with py27 and py35 which are the names of the venvs as seen from above commands).
activate py27
conda install jupyter
After that I tried to run:
jupyter notebook
I created a new notebook file to see if I had access to the kernel. However it was made clear that I didn't with the following error:
Traceback (most recent call last):
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\base\handlers.py", line 458, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\services\sessions\handlers.py", line 58, in post
sm.create_session(path=path, kernel_name=kernel_name))
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 73, in create_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "E:\Anaconda3\envs\py35\lib\site-packages\tornado\gen.py", line 282, in wrapper
yielded = next(result)
File "E:\Anaconda3\envs\py35\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 87, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\multikernelmanager.py", line 109, in start_kernel
km.start_kernel(**kwargs)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\manager.py", line 244, in start_kernel**kw)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\manager.py", line 190, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "E:\Anaconda3\envs\py35\lib\site-packages\jupyter_client\launcher.py", line 108, in launch_kernel
proc = Popen(cmd, **kwargs)
File "E:\Anaconda3\envs\py35\lib\subprocess.py", line 950, in __init__ restore_signals, start_new_session)
File "E:\Anaconda3\envs\py35\lib\subprocess.py", line 1220, in _execute_child startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
This was obviously tried on my py35 venv however I get the same error on my py27 venv. I have tried a few things such as running the kernelspec, but none of it to any success.
Someone got a suggestion to what might be wrong?
I had the same problem. You need to create a kernelspec for the jupyter notebook. Follow this link to solve it.
How to start an ipython shell(not notebook) within a conda or virtualenv
I 'm not able to install python packages from both pip and easy_install. There's some absurd kind of error that keeps popping up. Kindly help to rectify it.
I get the same errors while using python setup.py install.
Error while installing django-memcached
C:\Users\Praful\Desktop\django-redis-master>easy_install django-memcached
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 9, in <module>
load_entry_point('distribute==0.6.27', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1915, in main
with_ei_usage(lambda:
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1896, in with_ei_usage
return f()
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1919, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Error while installing python-memcache
C:\Users\Praful\Desktop\mem>python setup.py install
Traceback (most recent call last):
File "setup.py", line 24, in <module>
"Topic :: Software Development :: Libraries :: Python Modules",
File "C:\Python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Find get_entry_map(self, group=None): into python\Lib\sitepackages\pkg_resources\__init__.py. Insert after print self.egg_info
Run python setup.py and look to the last printed - broken package.
Remember it, later to install again. Delete the folder of broken
package and folder broken_package-version.dist-info. Run again paragraph 2, until the error disappears.
Remove changes from paragraph 1.
python setup.py install 'broken_package'
This error happened to me installing any package. My solution was going to my file explorer, typing in the path bar %appdata%, going to the Python folder, and deleting everything inside.
I found the same problem to be caused by a misfometted entry_points.txt file in one instelled egg of mine.
It can be quite hard to track down which one is if there are many.
I managed to find that little ba##!"d by creating and run setup.py for a dummy package:
setup.py
from setuptools import setup, find_packages
setup(
name = "IWillFindYou",
version = "0.1",
packages = find_packages()
)
run this in debug mode would point to this line in pkg_resources.py
def parse_map(cls, data, dist=None):
[...]
raise ValueError("Entry points must be listed in groups")
if you go back to the stack trace, you will see that parse_map is called here:
def get_entry_map(self, group=None):
[...]
ep_map = self._ep_map = EntryPoint.parse_map(
self._get_metadata('entry_points.txt'), self
)
evaluating self.egg_info will point up your evil egg so you can give a look to the entry_points.txt file.
If you are not handy with debugger, you may try to place print self.egg_info in get_entry_map and look to the last guy printed.
My Resolution Approach
Platform: windows 10, ConEmu-Maximus5
Delete virtual environment automatically created by poetry install command.
windows users can find the virtual environment folder in the path below
C:\Users\YOUR_PC_USERNAME\AppData\Local\pypoetry\Cache\virtualenvs
(don't know of linux path)
close terminal / command prompt
open terminal / command prompt and navigate to project folder
re run poetry install
I hope it helps...
How i encountered the error
It was my first time using poetry, while running poetry install, the process got interrupted. running the command again popped out the error.
Could be a problem with distribute. I'd recommend re-installing Python.
I have two python versions on my server namely 2.4 and 2.7. It is running RHEL 5.8.
I already have pip and easy_install installed on my server.
When I try to install ipython using easy_install or pip, it gives me an error which probably does not support in python 2.4.
I want to use python 2.7 for both pip and easy_install since I would want to use the latest version of the both.
What should I do to have pip and easy_install use python 2.7. Python 2.4 is installed by default by the system and I do want to keep it.
Python 2.7 is installed at another location.
Below is the traceback both for easy_install and pip. Both end up in the same error. Any kind of help is appreciated.
PIP
ronak#ronak fun $ sudo pip install ipython
Downloading/unpacking ipython
Downloading ipython-0.13.zip (6.4Mb): 6.4Mb downloaded
Running setup.py egg_info for package ipython
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/usr/local/home/ronak/fun/build/ipython/setup.py", line 23
from __future__ import print_function
SyntaxError: future feature print_function is not defined
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/usr/local/home/ronak/fun/build/ipython/setup.py", line 23
from __future__ import print_function
SyntaxError: future feature print_function is not defined
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/ronak/.pip/pip.log
EASY_INSTALL:
ronak#ronak $ sudo easy_install ipython
Searching for ipython
Reading http://pypi.python.org/simple/ipython/
Reading http://ipython.scipy.org
Reading http://ipython.scipy.org/dist
Reading http://ipython.scipy.org/dist/0.8.4
Reading http://ipython.scipy.org/dist/0.9.1
Reading http://ipython.org
Reading http://archive.ipython.org/release/0.12.1
Reading https://github.com/ipython/ipython/downloads
Reading http://ipython.scipy.org/dist/old/0.9
Reading http://ipython.scipy.org/dist/0.10
Reading http://archive.ipython.org/release/0.11/
Reading http://archive.ipython.org/release/0.12
Best match: ipython 0.13
Downloading https://github.com/downloads/ipython/ipython/ipython-0.13.zip
Processing ipython-0.13.zip
Running ipython-0.13/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vgPLN2/ipython-0.13/egg-dist-tmp-GHUgsq
Traceback (most recent call last):
File "/usr/bin/easy_install", line 7, in ?
sys.exit(
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 1712, in main
with_ei_usage(lambda:
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
return f()
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python2.4/distutils/core.py", line 149, in setup
dist.run_commands()
File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command
cmd_obj.run()
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 211, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 446, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 476, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 655, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 930, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/command/easy_install.py", line 919, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/sandbox.py", line 61, in run_setup
DirectorySandbox(setup_dir).run(
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/sandbox.py", line 105, in run
return func()
File "/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/setuptools/sandbox.py", line 64, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 23
from __future__ import print_function
SyntaxError: future feature print_function is not defined
One way would be:
Open pip/easy_install in text editor
Check top line, it should say
#! /usr/bin/python
Change it to #!path/to/python2.7
You should check this SO question.
You may also want to consider using virtual environment through virtualenv and virtualenvwrapper to manage which version of Python your packages should use.
If you would like to easily install iPython, SciPy, MatPlotLib, etc. by downloading a .dmg, you can try here:
http://www.enthought.com/products/epd_free.php
Or if you have a academic email address:
http://www.enthought.com/products/edudownload.php
sudo /location/to/python2.7 /path/to/pip install ipython
If you have a recent version of pip, you an also try sudo pip-2.7 install ipython