Python pkg_resources.DistributionNotFound Error - python

I am trying to install Trac on windows (64-bit) and i have followed all the installation guidelines.
But when i try to run the trac standalone server using tracd, i get this error:
PS C:\Python27\Scripts> .\tracd.exe --port 8000 D:\TracEnv\
Traceback (most recent call last):
File "C:\Python27\Scripts\tracd-script.py", line 5, in <module>
from pkg_resources import load_entry_point
File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 2927, in <module>
File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 2913, in _call_aside
File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 2940, in _initialize_master_working_set
File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 635, in _build_master
File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 943, in require
File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 829, in resolve
pkg_resources.DistributionNotFound: The 'trac==1.0' distribution was not found and is required by the application
I have installed trac and it is present in the site package directory where i installed python.
-a--- 4/15/2016 4:25 PM 1894048 trac-1.0-py2.7.egg
So why is it not able to find trac?
i do not have admin access on this PC. I do not know python, i just want to install and learn how to use Trac.

Related

"sre_constants.error: nothing to repeat" error every time trying to install using pip

I just installed Python 2.7.5 on my Windows 10 machine and I also got pip installed through setuptools. However whenever I try to install something using pip e.g. pip install numpy, I get this error message:
Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 8, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 318, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2221, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 73, in <module>
__import__('pip._vendor.packaging.specifiers')
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\packaging\specifiers.py", line 275, in <module>
class Specifier(_IndividualSpecifier):
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\packaging\specifiers.py", line 373, in Specifier
r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)
File "C:\Python27\Lib\re.py", line 190, in compile
return _compile(pattern, flags)
File "C:\Python27\Lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
Since I'm pretty new to Python, I don't really understand what this error means. Any workaround?
I had a similar issue with a library that is using regular expressions (with the re.compile() function). I solved this issue installing the last version available 2.7.13 (I run a Windows 7).
Before I had the 2.7.6 version. I updated it installing the new version with the .msi installer, available in the Python web page.

Trying to run Scrapy

I am trying to run Scrapy and encountering the following error.
It seems that Scrapy can't find TheTwisted 10.0.0 - I've downloaded it but don't know where to place the folder. Thanks!
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 5, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3095, in
#_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3081, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3108, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 658, in _build_master
ws.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 959, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 846, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Twisted>=10.0.0' distribution was not found and is required by Scrapy
If using Linux, install Twisted by running pip install Twisted in terminal.
If Windows, the Twisted docs recommend pip install Twisted[windows_platform].
In both cases if you're using a virtual environment (recommended) make sure to install it inside the venv.

Pyinstaller / Django - pkg_resources.DistributionNotFound: The 'django-omnibus' distribution was not found

I am trying to create an installer for a django website that uses the django-omnibus module.
My Pyinstaller command:
pyinstaller --name djangosite manage.py
The Pyinstaller command runs to completion.
Trying to run the web server using
djangosite.exe runserver localhost:8000
I get the following error:
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "django\core\management\__init__.py", line 338, in execute_from_command_line
File "django\core\management\__init__.py", line 312, in execute
File "django\__init__.py", line 18, in setup
File "django\apps\registry.py", line 85, in populate
File "django\apps\config.py", line 86, in create
File "importlib\__init__.py", line 37, in import_module
File "c:\users\USERNAME\appdata\local\temp\pip-build-vxcefe\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
File "omnibus\__init__.py", line 3, in <module>
File "pkg_resources\__init__.py", line 561, in get_distribution
File "pkg_resources\__init__.py", line 441, in get_provider
File "pkg_resources\__init__.py", line 962, in require
File "pkg_resources\__init__.py", line 849, in resolve
pkg_resources.DistributionNotFound: The 'django-omnibus' distribution was not found and is required by the application manage returned -1
If I remove all django-omnibus code, the site works fine (except for the my websocket functionality obviously). Any ideas? Thanks.
I needed to add a hook.py file for django-omnibus and add the --additional-hooks-dir=. flag to the pyinstaller command.
hook-omnibus.py
from PyInstaller.utils.hooks import copy_metadata, collect_data_files
datas = copy_metadata('django-omnibus')
datas += collect_data_files('omnibus')
Similar answer here:
https://github.com/pyinstaller/pyinstaller/issues/1713
I know this is a late reply, but I had a similar issue with django-user-accounts - pkg_resources.DistributionNotFound: The 'django-user-accounts' distribution was not found
I was directed here when searching for a fix. I solved the issue with the following addition to settings.py - hopefully helps someone else.
INSTALLED_APPS = [
...
'django.contrib.sites',
...
]

Virtualenv: psycopg2 and mxDateTime [duplicate]

this is the error :
(mysite)zjm1126#zjm1126-G41MT-S2:~/zjm_test/mysite$ ./bin/easy_install libmysqld-dev
Searching for libmysqld-dev
Reading http://pypi.python.org/simple/libmysqld-dev/
Couldn't find index page for 'libmysqld-dev' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for libmysqld-dev
Best match: None
Traceback (most recent call last):
File "./bin/easy_install", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 1712, in main
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 1716, in <lambda>
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 211, in run
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 434, in easy_install
File "/home/zjm1126/zjm_test/mysite/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/package_index.py", line 475, in fetch_distribution
AttributeError: 'NoneType' object has no attribute 'clone'
what can i do,
thanks
Try to update setuptools:
easy_install -U setuptools
This error indicates that easy-install cannot locate the package, meaning that it is not found.
You'd be better off installing the dev package via your distribution's package manager (apt-get etc)
If you examine the output carefully, notice:
Reading http://pypi.python.org/simple/
No local packages or download links found for libmysqld-dev
Best match: None

GAE " no attribute 'HTTPSHandler' " dev_appserver.py

I am trying to use the google appengine python SKD from my ubuntu lucid. I have already compiled python2.5. But when I execute any "dev_appserver.py" command with it I get the following error:
Traceback (most recent call last):
File "dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 90, in <module>
from google.appengine.tools import appcfg
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appcfg.py", line 59, in <module>
from google.appengine.tools import appengine_rpc
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appengine_rpc.py", line 24, in <module>
import fancy_urllib
File "/media/Ultimate/WebD/django/app_engine/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 328, in <module>
class FancyHTTPSHandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'
I have checked the urllib2 moduls of python2.6 and python2.5 but there was no difference in the models defination and HTTPSHandelr is there in python2.5 too. So I guess it is some other sort of error.
I tried to run with the default python2.6 too but then I get the following error:
WARNING 2010-09-11 12:08:40,848 datastore_file_stub.py:657] Could not read datastore data from /tmp/dev_appserver.datastore
Traceback (most recent call last):
File "./dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "./dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 449, in <module>
sys.exit(main(sys.argv))
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 426, in main
static_caching=static_caching)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3820, in CreateServer
server = HTTPServerWithScheduler((serve_address, port), handler_class)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3840, in __init__
request_handler_class)
File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
self.server_bind()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.6/SocketServer.py", line 411, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
It works well in windows and even under wine.
Update
Problem with python2.6 solved.
I had configured my apache server for a django deployment on the 8080 and 80 port some time earlier.
But there is still same error with python2.5 isntallation.
Solved the issue...just needed to build all dependencies of python using:
apt-get build-dep python
python compiles with no error even when all the dependencies are not installed. It just skips the modules which require them and builds python.
Solution for missing HTTPSHandler:
Before you build python 2.5 from source you need to enable ssl-socket by editing Modules/Setup.dist (more info here http://paltman.com/2007/nov/15/getting-ssl-support-in-python-251/)
The method described in this post worked perfectly for me (Ubuntu 11.10).
http://dewbot.posterous.com/installation-of-python-25-and-google-app-engi

Categories

Resources