7

I started my first project with cookiecutter using the cookiecutter-django template.

When I tried to start it from PyCharm using the virtualenv, it gave me an error in a lib file: environ.py, telling me this:

  File "/home/madtyn/venvs/nana/lib/python3.6/site-packages/environ.py", line 114
    raise ValueError, "No frame marked with %s." % fname
                    ^
SyntaxError: invalid syntax

After searching, I consulted somebody and I was recommended another way. I tried, as they told me, to make a new venv,

python3 -m venv /home/madtyn/venvs/name

activate it

source /home/madtyn/venvs/name/bin/activate

and run the server from command line but the same thing seems to happen.

I don't think I did anything wrong. These are my specifications:

  • Kubuntu (64bit arch)
  • Python 3.6.8 (both the venv and the main one)
  • cookiecutter 1.6.0 (installed through pip3)
  • PyCharm 2019.2.2
madtyn
  • 1,469
  • 27
  • 55
  • 1
    Please show exactly what you typed to set up your venv and install the libraries, plus the *full* traceback. Somehow you have installed a module - environ.py - that is not compatible with Python 3. – Daniel Roseman Sep 24 '19 at 09:00
  • 1
    Did you actually install the requirements in your virtualenv? After source you should do `pip install -r requirements/local.txt`. – frankie567 Sep 24 '19 at 09:07
  • Well, that made a difference. Now is complaining about the database, so you can answer that and I will consider it as the solution and the problem to be solved. Thank you – madtyn Sep 24 '19 at 09:17
  • @madtyn The full error would be useful in order to help you on this matter :) – frankie567 Sep 24 '19 at 10:00
  • @frankie567 If you mean about the new database error, it is a normal error, almost an expected error and I knew about it and how to solve it. I consider the question answered and I'm accepting your answer as soon as you post it down here. The solution was to install those requirements. My bad. – madtyn Sep 24 '19 at 14:32
  • @madtyn Oh, ok, sorry, I misunderstood your comment :) Thanks! – frankie567 Sep 24 '19 at 14:43

2 Answers2

10

if you need environ for Django use

pip install django-environ

so this error will go out

klockvud
  • 99
  • 1
  • 5
2

You should install the Python dependencies after having activated your virtual environment:

pip install -r requirements/local.txt
frankie567
  • 1,703
  • 12
  • 20