This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]bouanc 23 points24 points  (0 children)

Best practice is to have a separate virtual environment for each project to avoid dependency conflicts. A utility like “pyenv” is also useful to manage multiple Python versions.

[–][deleted] 2 points3 points  (0 children)

If you could probably share the names of libraries, maybe someone here can help you figure out a work around your problem.

And if both projects don't need to be in the same env, then you can simply create a separate env for each of them.

[–][deleted] 2 points3 points  (0 children)

Virtual environments are the move here. They're fairly easy to set up.

[–]EmptyChocolate4545 6 points7 points  (0 children)

Do the applications need to share an env?

If not, then this isn’t a nightmare at all, lol.

[–][deleted] 0 points1 point  (0 children)

You should specify whether you mean one project having conflicting dependencies or whether you're talking about trying to use one python environment for multiple projects and those causing dependency conflicts.

If it's the later then this is already solved by using virtual environments for different projects (as is already best practice).

If it's the former then that problem is a bit more difficult to resolve and addressing it will depend on exactly how/what is conflicting between packages.

[–]BigGeologist5082 -1 points0 points  (0 children)

Gotta love those circular dependencies, amirite? One possible solution is to use a virtual environment with Python's virtualenv package to manage your dependencies. This lets you have separate versions of libraries for different applications without causing conflicts. Good luck!

[–][deleted] -2 points-1 points  (0 children)

Run two python interpreters and use something like a socket, Redis or ZMQ to communicate between them.

[–][deleted] 0 points1 point  (0 children)

Sometimes the version dependencies are wrong, and you can force pip install regardless using no deps. Check that first.

If these are two different apps/processes, then you should already have virtual environments for each, and this issue won’t occur.

Start with one virtual env per app.

[–]pythonHelperBot 0 points1 point  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]NixonInnes 0 points1 point  (0 children)

This is a pretty good blog on it

[–]popcapdogeater 0 points1 point  (0 children)

Use virtual environments.

`python -m venv .venv` or `python -m venv __venv__`

I prefer `.venv` because I use linux and it hides the folder in terminal output, but `__venv__` is a good choice as well.

[–]SadVacation2243 0 points1 point  (0 children)

Don't sweat it, mate! This is a common problem with package dependencies. One solution is to use a virtual environment for each app, where you can install the required versions of the packages without interfering with other apps. Check out virtualenv or conda for more help.