سؤال

I'm trying to get the Python libraries for Reddit installed on my Mac. I want to run them using PyCharm for development as I like it as a Python IDE.

I'm running the Cassandra, Memcached, RabbitMQ, and Postgres servers inside a Virtual Box instance that is accessible via the Virtual Box Host-only adapter. This is working as I can start Reddit in the Virtual Box and access it from my Mac just fine.

When running the paster script to see if the Reddit Python source install is working on the Mac. I get the following error:

    Traceback (most recent call last):
  File "/Users/inflector/software/new-day/reddit/dev/bin/paster", line 8, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File "/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages/paste/script/command.py", line 93, in run
    commands = get_commands()
  File "/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages/paste/script/command.py", line 135, in get_commands
    plugins = pluginlib.resolve_plugins(plugins)
  File "/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages/paste/script/pluginlib.py", line 82, in resolve_plugins
    pkg_resources.require(plugin)
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 666, in require
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 569, in resolve
pkg_resources.VersionConflict: (WebOb 1.2.3 (/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages), Requirement.parse('webob==1.0.8'))

If I downgrade the installation to WebOb 1.0.8, I get the reverse, it wants 'WebOb>=1.2'.

'pip list' shows these packages installed:

amqplib (1.0.2)
Babel (0.9.6)
bcrypt (1.0.2)
Beaker (1.6.4)
BeautifulSoup (3.2.1)
beautifulsoup4 (4.2.1)
boto (2.9.5)
cffi (0.6)
chardet (2.1.1)
crypto (1.1.0)
cssutils (0.9.5.1)
Cython (0.19.1)
decorator (3.4.0)
FormEncode (1.2.6)
kazoo (1.1)
l2cs (2.0.2)
lxml (3.2.1)
Mako (0.8.1)
MarkupSafe (0.18)
nose (1.3.0)
Paste (1.7.5.1)
PasteDeploy (1.5.0)
PasteScript (1.7.5)
PIL (1.1.7)
psycopg2 (2.5)
py-bcrypt (0.3)
pyasn1 (0.1.7)
PyCAPTCHA (0.4)
pycassa (1.9.0)
pycountry (0.14.8)
pycparser (2.09.1)
pycrypto (2.6)
Pygments (1.6)
pylibmc (1.2.3)
Pylons (0.9.7)
pytz (2013b)
repoze.lru (0.6)
requests (1.2.3)
Routes (1.11)
rsa (3.1.1)
simplejson (3.3.0)
six (1.3.0)
snudown (1.1.5)
SQLAlchemy (0.7.4)
stripe (1.9.1)
Tempita (0.5.1)
thrift (0.9.0)
waitress (0.8.5)
WebError (0.10.3)
WebHelpers (1.3)
WebOb (1.2.3)
WebTest (2.0.6)
Whoosh (2.4.1)
wsgiref (0.1.2)
zope.interface (4.0.5)

My hypothesis is that at least one of these packages requires WebOb==1.0.8 and at least one other requires WebOb>=1.2

I've setup a virtualenv for the Reddit install and set it up with the --no-site-packages option so that I'm only dealing with the packages I need for Reddit. I manually installed everything that I think I need. So this is actually the minimum set of packages. I need each of them, but perhaps not all of them are the correct versions. The Reddit installer doesn't specify versions for every package, only some of them.

So how do I track down these dependencies? How do I get a list of the requirements for each of the packages installed in the virtualenv?

And where is the file: "build/bdist.linux-i686/egg/pkg_resources.py" coming from? I can't find it anywhere in my system. And the Mac is not linux so this seems odd.

I'm a very experienced programmer, C++, Java, Object Pascal, Objective C, etc. but not an expert Python programmer yet. So the Python package system is too much of a black box to me at this point. I can use pip and run setup.py scripts but I don't yet grok them.

هل كانت مفيدة؟

المحلول

The problem was coming from having a version 2.0.6 of the WebTest library. This version was the one requiring WebOb>=1.2.

To determine the requirements for the python modules. I cd'd into the site-packages directory for the virtual env and then ran:

grep WebOb *.egg-info/requires.txt

which returned:

Pylons-0.9.7-py2.7.egg-info/requires.txt:WebOb>=0.9.6.1
WebError-0.10.3-py2.7.egg-info/requires.txt:WebOb
WebTest-2.0.6-py2.7.egg-info/requires.txt:WebOb>=1.2

where I was able to see that WebTest was the conflicting package.

I was then able to go into my Ubuntu install to see what package for WebTest was installed found that WebTest 1.3.3 worked on the standard Ubuntu Reddit install. So I uninstalled both WebOb 1.2 and WebTest 2.0.6 and then ran:

pip install webob==1.0.8
pip install webtest==1.3.3

This got rid of the conflict WebOb versions conflict. I still can't yet get Reddit to run, but at least I removed this block.

نصائح أخرى

Reddit's installer adds an Ubuntu private package repository. The PPA includes many variants of Ubuntu python packages.

If you are running Ubuntu, you can also install the PPA.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top