#27591: running manage.py with virtual environment
-------------------------------------+-------------------------------------
Reporter: Satheesan Varier | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.10
Severity: Normal | Resolution: invalid
Keywords: Django, Virtualenv, | Triage Stage:
Powershell | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):
* status: new => closed
* resolution: => invalid
Old description:
> Virtual Environment : Windows Powershell 5.0 /
> virtualenvironmentwrapper-powershell
> Python : 2.7.12 / Django: 1.10.4
> ----------------------------------------------------------------------------------------------------------------------------------------------
> Outside venvs the following are installed
> virtualenv==15.1.0
> virtualenvwrapper-powershell==12.7.8
> -----------------------------------------------------------------------------------------------------------------------------------------------
> Inside venv, Django is installed
> -----------------------------------------------------------------------------------------------------------------------------------------------
> django-admin startproject mysite
> -----------------------------------------------------------------------------------------------------------------------------------------------
> manage.py shell ( throws ImportError )
> -------------------------------------------------------------------------------------------------------------
> try:
> import django
> except ImportError:
> raise ImportError(
> "Couldn't import Django. Are you sure it's installed and "
> "available on your PYTHONPATH environment variable? Did you "
> "forget to activate a virtual environment?"
> )
> --------------------------------------------------------------------------------------------------------------
> Observation 1 : Even though manage.py is unable to import Django
> if we open a python shell, we can import django
> --------------------------------------------------------------------------------------------------------------
> Observation 2 : If we pip install Django outside the venv redundantly
> then manage.py will not throw ImportError on any of the manage.py
> commands. it will pickup django from there.
> --------------------------------------------------------------------------------------------------------------
> Issue : manage.py should get Django from the virtualenv
> --------------------------------------------------------------------------------------------------------------
New description:
Virtual Environment : Windows Powershell 5.0 /
virtualenvironmentwrapper-powershell
Python : 2.7.12 / Django: 1.10.4
----------------------------------------------------------------------------------------------------------------------------------------------
Outside venvs the following are installed
virtualenv==15.1.0
virtualenvwrapper-powershell==12.7.8
-----------------------------------------------------------------------------------------------------------------------------------------------
Inside venv, Django is installed
-----------------------------------------------------------------------------------------------------------------------------------------------
django-admin startproject mysite
-----------------------------------------------------------------------------------------------------------------------------------------------
manage.py shell ( throws ImportError )
-------------------------------------------------------------------------------------------------------------
{{{
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
}}}
--------------------------------------------------------------------------------------------------------------
Observation 1 : Even though manage.py is unable to import Django
if we open a python shell, we can import django
--------------------------------------------------------------------------------------------------------------
Observation 2 : If we pip install Django outside the venv redundantly
then manage.py will not throw ImportError on any of the manage.py
commands. it will pickup django from there.
--------------------------------------------------------------------------------------------------------------
Issue : manage.py should get Django from the virtualenv
--------------------------------------------------------------------------------------------------------------
--
Comment:
To get help, please see TicketClosingReasons/UseSupportChannels. If Django
turns out to be at fault, please reopen with an explanation of why.
--
Ticket URL: <https://code.djangoproject.com/ticket/27591#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/073.9fd66eb1be2373cbfa4c8e3346c9633d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.