Click here to Skip to main content
15,896,359 members
Home / Discussions / Python
   

Python

 
GeneralRe: Unexpected token 'root' Pin
s yu13-Oct-22 2:28
s yu13-Oct-22 2:28 
Questionhello, good day, does anyone know how to solve this problem? It would help me a lot if you could explain how to do it Pin
Member 157924299-Oct-22 18:35
Member 157924299-Oct-22 18:35 
AnswerRe: hello, good day, does anyone know how to solve this problem? It would help me a lot if you could explain how to do it Pin
Richard MacCutchan9-Oct-22 22:16
mveRichard MacCutchan9-Oct-22 22:16 
AnswerRe: hello, good day, does anyone know how to solve this problem? It would help me a lot if you could explain how to do it Pin
Reverend Jim10-Jun-23 4:51
Reverend Jim10-Jun-23 4:51 
QuestionCan you have a virtual environment based on a virtual environment? Pin
Chris Maunder5-Oct-22 12:16
cofounderChris Maunder5-Oct-22 12:16 
AnswerRe: Can you have a virtual environment based on a virtual environment? Pin
trønderen5-Oct-22 12:34
trønderen5-Oct-22 12:34 
AnswerRe: Can you have a virtual environment based on a virtual environment? Pin
Richard MacCutchan5-Oct-22 22:54
mveRichard MacCutchan5-Oct-22 22:54 
GeneralRe: Can you have a virtual environment based on a virtual environment? Pin
Chris Maunder18-Oct-22 3:16
cofounderChris Maunder18-Oct-22 3:16 
I guess I could do this manually, since it's only really the site-packages I'm worried about. Something like

Suppose I have two apps that have different and potentially conflicting packages. I'd create a venv with the python interpreter in /app/bin/python and the common packages in /app/bin/python/site-packages-common. I'd then install specific packages for app A and B in different folders:
/app/bin/python
/app/bin/python/site-packages-common
/app/bin/python/site-packages-A
/app/bin/python/site-packages-B
then in app A I could do
Python
sys.path.insert(0, "/app/bin/python/site-packages-common")
sys.path.insert(0, "/app/bin/python/site-packages-A")

and in app B I could do
Python
sys.path.insert(0, "/app/bin/python/site-packages-common")
sys.path.insert(0, "/app/bin/python/site-packages-B")

I would have to specify the target folder when running pip to install the packages (no drama).

My big concern is if we have the following:
pip install common-package -target /app/bin/python/site-packages-common
pip install package-a -target /app/bin/python/site-packages-A
pip install package-b -target /app/bin/python/site-packages-B

What if package-a relies on v1 of common-package, and package-b relies on v2 of common-package?

I'm actually assuming pip will install all dependent packages anyway, so while we might end up with repeated installs of dependant packages, there are certainly some 'common' packages that won't necessarily be dependencies of anything and so will only be installed once in the common folder
cheers
Chris Maunder

GeneralRe: Can you have a virtual environment based on a virtual environment? Pin
Richard MacCutchan18-Oct-22 3:45
mveRichard MacCutchan18-Oct-22 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.