0

I am completing the Quick Tutorial for Pyramid which is written for a Linux system and I am using Windows, so I convert each command to a Windows equivalent.

In Tutorial Step: Quick Project Startup with Cookiecutters I run into the following issues:

Command written in the Tutorial: i.e. for linux

$VENV/bin/pip install cookiecutter

What I do in Windows:

I activate the virtual environment with:

c:\projects\quick_tutorial\env\Scripts\Activate

Then I use the Windows command:

(env) c:\projects\quick_tutorial\env\Scripts\pip install cookiecutter

Similarly, I then run the following command:

(env) c:\projects\quick_tutorial\env\Scripts\cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter

The above command places a new folder: cc_starter inside my "...env\Scripts" folder. I assume this doesn't make sense, so I move cc_starter into c:\projects\quick_tutorial.

At this point my directory looks like: My Director, which: (1) doesn't contain a "bin" folder; and (2) doesn't have the "cc_starter" folder inside the "env" folder. <-- I assume these are the 2 main differences between how this project with virtual environment should be structured differently between Linux and Windows

The Problem:

The final part of this tutorial step is to run:

$ env/bin/pserve development.ini --reload

^^ for Linux

My Windows equivalent:

(env) c:\projects\quick_tutorial\cc_starter\pserve development.ini --reload

This unfortunately returns the following Traceback (most recent call last):

File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
"main", mod_spec) File "C:\Python34\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "c:\projects\quick_tutorial\env\Scripts\pserve.exe__main__.py", line 9, in File
"C:\Python34\Lib\site-packages\pyramid\scripts\pserve.py", line 60,
in main return command.run() File "C:\Python34\Lib\site-packages\pyramid\scripts\pserve.py", line 371,
in run global_conf=vars) File "C:\Python34\Lib\site-packages\pyramid\scripts\pserve.py", line 406,
in loadapp return loadapp(app_spec, name=name, relative_to=relative_to, **kw) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 247,
in loadapp return loadobj(APP, uri, name=name, **kw) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 271,
in loadobj global_conf=global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 296,
in loadcontext global_conf=global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 320,
in _loadconfig return loader.get_context(object_type, name, global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 454,
in get_context section) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 476,
in _context_from_use object_type, name=use, global_conf=global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 406,
in get_context global_conf=global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 296,
in loadcontext global_conf=global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 328,
in _loadegg return loader.get_context(object_type, name, global_conf) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 620,
in get_context object_type, name=name) File "C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 640,
in find_egg_entry_point pkg_resources.require(self.spec) File "C:\Python34\Lib\site-packages\pkg_resources.py", line 669, in
require needed = self.resolve(parse_requirements(requirements))
File "C:\Python34\Lib\site-packages\pkg_resources.py", line 572, in
resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: cc-starter

(sorry about the block of text, it was copied directly out of command prompt)

Questions:

  1. Do I need to run the "Activate" command, as I have done, inside the Scripts folder?
  2. Is env\Scripts folder the equivalent of env\bin in Linux ?
  3. Am I meant to move the "cc_starter folder" out of quick_tutorial\env\Scripts and place into \quick_tutorial? (as I have done)
  4. What do I need to do to avoid error when I load development.ini?
Wronski
  • 1,506
  • 3
  • 18
  • 37

2 Answers2

0

First there is a PR for installing cookiecutter on Windows 10 that has been tested (by me in a VM). See https://github.com/stevepiercy/cookiecutter/blob/99250649aa3f4ba77091a72fe5df42d7f59859e6/docs/installation.rst and ping the maintainers of cookiecutter to merge the PR https://github.com/audreyr/cookiecutter/pull/887

  1. We don't recommend activate. See http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/install.html#venv-bin-pip-vs-source-bin-activate

    Instead use an environment variable set to the Path or invoke the command using the full path to the executable. See http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/requirements.html

  2. Close enough. For Linux, substitute / for \.
  3. You should not move any folders or files at this step.
  4. See previous items. The last line in the stacktrace indicates that the cc-starter package could not be found, either because you relocated it or you jumped into activate, or both.
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • I tried to install cookiecutter in the virtual env: `c:\projects\quick_tutorial\env\Scripts>pip install cookiecutter` Returns: `Requirement already satisfied (use --upgrade to upgrade): cookiecutter in c:\python34\lib\site-packages` Then I try: `c:\projects\quick_tutorial\env\Scripts\cc_starter>pserve development.ini --reload` Returns same error: "...resolve pkg_resources.DistributionNotFound: cc-starter" **Question:** How do I ensure cc_starter can be found to resolve the traceback error? nb: I didn't use `activate` and I left the folder within `/env/Scripts` – Wronski Feb 07 '17 at 22:31
0

Found the problem! In the tutorial: Quick Project Startup with Cookiecutters, it wasn't clear that I had to complete the following commands myself:

# Change directory into your newly created project.
$ cd cc_starter
# Create a new virtual environment...
$ python3 -m venv env
# ...where we upgrade packaging tools...
$ env/bin/pip install --upgrade pip setuptools
# ...and into which we install our project.
$ env/bin/pip install -e .

After running these commands, I was able to successfully complete the tutorial. Thank you, Steve Piercy for your help.

Wronski
  • 1,506
  • 3
  • 18
  • 37
  • Glad you figured it out. If it is not clear, please suggest improvements to the documentation to make it more clear. Cookiecutters are new in Pyramid 1.8, and Windows is my tertiary platform. – Steve Piercy Feb 08 '17 at 07:56