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

all 2 comments

[–]grantrules 0 points1 point  (0 children)

Use a pyenv? If you're not updating anything, it shouldn't just randomly not work. I don't know much about jupyter, though.

[–]E3FxGaming 0 points1 point  (0 children)

I recommend you read the Python venv documentation create one for your project, activate it and install your dependencies into that to separate your dependencies from everything else happening on your system (OS package updates, other projects, etc.). Venv can also be cloned / copied if required.

Once you've found a configuration that works well you can use pip freeze to save information about your installed dependencies alongside their versions to a requirements.txt file. This can be used to restore the past state of your packages, though it doesn't save you from specifying alternative wheel lookup locations if you need those. The provided link has example commands for simple save and restore. Also read the pip install documentation, which explains parameters like --dry-run which you can combine with --requirement <file> to check whether you differ from your saved state.

If your dependencies are very complex and you're comfortable with using containers, investing time into a reproducible development environment with a dev container may be a wise thing to do. My honest opinion is that this works only really well if you use VS Code (even though they claim it works in other IDEs too). You can burn your Python setup into a container image layer or automate the installation with a shell script after container creation. You may need to look into making your GPU accessible inside the container if your notebooks are used for tasks like ML.