I'm taking over a project. 5 engineers worked on this for several years, but they are all gone. I've been tasked with trying to revive this project and keep it going. It's a big Python project with several complicated install scripts which, nowadays, have many version errors, because the stuff that worked 3 or 4 years ago is all long since deprecated and possibly discontinued.
Buried deep in one of the many install scripts (they all call each other multiple times, in a spaghetti that I cannot figure out) there is probably an instruction that sets up a virtual environment, but I can't find the line and I don't care. This software is going onto a clean install of an EC2 (with Centos 7) that I control completely. And this piece of software is the only software that will ever run on this EC2 instance, so I'm happy to install everything globally.
The install script was unable to find Python 3.6 so I manually did this:
pip3 install astroid
pip3 install cycler
pip3 install decorator
pip3 install fancycompleter
pip3 install ipython
pip3 install isort
pip3 install kiwisolver
pip3 install lazy-object-proxy
pip3 install matplotlib
pip3 install numpy
pip3 install pillow
pip3 install platformdirs
pip3 install pluggy
pip3 install prompt-toolkit
pip3 install pygments
pip3 install pyparsing
pip3 install pytest
pip3 install tomli
pip3 install typed-ast
pip3 install typing-extensions
pip3 install asgiref
pip3 install charset-normalizer
pip3 install click
pip3 install django
pip3 install django-timezone-field
pip3 install idna
pip3 install markdown
pip3 install markupsafe
pip3 install pyodbc
pip3 install python-nmap
pip3 install pyyaml
pip3 install sqlparse
pip3 install uritemplate
If I go into the Python shell and run help(modules)
I can see the Django is installed.
But when I run the final install script:
/home/centos/blueflow/blueflow/bin/blueflow-django-manage compilejsx -o ./blueflow/jsx/JSXRegistry.jsx
Part of the error reads:
Couldn't import Django. Are you sure it's installed
What would be the fastest way to get the code to see the right path to Django? Is there an obvious way I can break out of all virtual environments and force the code to use the global environment for everything (which I'm thinking would be the simplest approach)?
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Loading .env environment variables...
Warning: There was an unexpected error while activating your virtualenv. Continuing anyway...
Traceback (most recent call last):
File "/home/centos/blueflow/blueflow/app/manage.py", line 20, in <module>
"Couldn't import Django. Are you sure it's installed and "
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?
[[ Update ]]
Someone asked about the contents of:
/home/centos/blueflow/blueflow/bin/blueflow-django-manage
This is the whole file:
#!/bin/bash
#
# blueflow-django-manage
#
# Shim for Django's "python manage.py" that supports different plaforms
# Copyright (C) 2018 Virta Laboratories, Inc. All rights reserved.
# Stop on errors
set -e
# Path to BlueFlow installation
BLUEFLOW_HOME=${BLUEFLOW_HOME:=`cd $(dirname $0)/.. && pwd -P`}
# Defaults
PIPENV=${BLUEFLOW_HOME}/bin/blueflow-pipenv
DJANGO_MANAGE="${PIPENV} run python ${BLUEFLOW_HOME}/app/manage.py"
# Platform-specific section
OS=`${BLUEFLOW_HOME}/bin/blueflow-os-detect`
case ${OS} in
"Ubuntu-16.04")
DJANGO_MANAGE="sudo -Eu blueflow ${DJANGO_MANAGE}"
;;
"RHEL7")
if [[ "${DJANGO_SETTINGS_MODULE}" != "app.settings.development" ]]; then
DJANGO_MANAGE="sudo -Eu blueflow ${DJANGO_MANAGE}"
else
DJANGO_MANAGE="sudo -Eu $(id -un) ${DJANGO_MANAGE}"
fi
;;
"RHEL8")
if [[ "${DJANGO_SETTINGS_MODULE}" != "app.settings.development" ]]; then
DJANGO_MANAGE="sudo -Eu blueflow ${DJANGO_MANAGE}"
else
DJANGO_MANAGE="sudo -Eu $(id -un) ${DJANGO_MANAGE}"
fi
;;
esac
# Replace this subshell with command
exec ${DJANGO_MANAGE} "$@"