How to install new packages for pyramid without getting a pkg_resources.DistributionNotFound: once a project has been created

How to install new packages for pyramid without getting a pkg_resources.DistributionNotFound: once a project has been created

I have installed pyramid and successfully created a project, but when I try to add new packages to the setup.py requirements they always give me a pkg_resources.DistributionNotFound error.

The packages are installed, and this only happens if I try to install new packages after I run ../bin/python3.3 setup.py develop It doesn’t matter what packages it is.

The only way I have solved (not really), is setting up a new virtual environment and installing the packages before I create the project and run setup.py develop.

Obviously I’m doing something wrong. Is there anything I need to do beside pip install the package? Is this some kind of pathing issue? I’m new to this so your help would be so very appreciated!

*Adding my installation process in case anyone happens to see something wrong with it. Also including my wsgi file.

Created a virtualenv
easy_install-3.3 env

Activated the virtualenv
source env/bin/activate

Installed pyramid
cd env
./bin/easy_install-3.3 pyramid

Created a project
./bin/pcreate -s starter myprojectname

Ran setup.py
cd myprojectname
../bin/python3.3 setup.py develop

At this point I get the following error: pkg_resources.DistributionNotFound: waitress

Installed Waitress
../bin/easy_install-3.3 waitress

Ran setup.py again (not sure if I should be doing this)
../bin/python3.3 setup.py develop

Still see the error

My .wsgi file contains the following (not sure if this is important to this question or not):
activate_this = "/home/account/env/bin/activate_this.py"
execfile(activate_this,dict(__file__=activate_this))

import os
import sys

path = '/home/account/env/lib/python3.3/site-packages'

if path not in sys.path:
sys.path.append(path)

from pyramid.paster import get_app
application = get_app('/home/account/env/myprojectname/production.ini', 'main')

Best answer

pip and setup.py develop should not to be mixed. The latter uses easy_install which is not compatible with pip in the case of namespace packages (these are packages that are installed as subpackages of another parent, such as zope.sqlalchemy installing only the .sqlalchemy part of the full zope.* package). Namespace packages will cause problems between pip and easy_install. On the other hand, most other packages will work fine with whatever system you choose but it’s better for you to be consistent.

Another thing to double check is that you are actually installing the packages into your virtualenv. You should be able to open the python cli in your virtualenv and import the package. If you can’t, then it’s probably not installed.