How to install new packages for the pyramid without getting pkg_resources.DistributionNotFound: once the project was created

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

Packages are installed, and this only happens if I try to install new packages after starting. / bin / python 3.3 setup.py development. It doesn't matter what packages he has.

The only way I decided (not really) is to create a new virtual environment and install the packages before I create the project and run setup.py.

Obviously I'm doing something wrong. Is there anything I need to do next to the package, install the package? Is this some kind of problem? I am new to this, so your help would be greatly appreciated!

* Adding my installation process in case someone accidentally sees something with him. Also including my wsgi file.

Created by virtualenv easy_install-3.3 env

Activated 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 moment, 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 do this) ../bin/python3.3 setup.py develop

Still see the error

The My.wsgi file contains the following (not sure if this is important for 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')

+6
source share
2 answers

pip and setup.py develop should not be mixed. The latter uses easy_install, which is incompatible with pip in the case of namespace packages (these are packages that are installed as subpackages of another parent, such as zope.sqlalchemy, which install only part of the .sqlalchemy full zope. * Package). Namespace packages will cause problems between pip and easy_install. Most other packages, on the other hand, work great with any system you choose, but it’s best for you to be consistent.

Another thing that needs to be checked twice is that you are actually installing packages in your virtualenv. You should open python cli in your virtual directory and import the package. If you cannot, then it is probably not installed.

+3
source

Using Michael's suggestions above, I was able to solve his problem. I didn’t even need to install any packages manually. Once everything works, if I add a requirement to my setup.py file (which is created when the pyramid project is created) and run the install -e pip command. everything was fine again. The problem was caused by the way I installed things. Here is my last process if it helps any other newcomers to the pyramid:

  • Created virtual environment virtualenv-3.3 env

  • Env source env/bin/activate activated env source env/bin/activate

  • Moved to the cd env directory

  • Installed pyramid pip install pyramid

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

  • Moved to project directory cd megaproject

  • Ran install pip install -e .

  • updated my wsgi file with env and project settings

  • reload the application and jump for joy to see the page with a beautiful pyramid.

+5
source

Source: https://habr.com/ru/post/947767/


All Articles