Python Forum
How to package code for different python environments
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to package code for different python environments
#1
I want to develop a toolkit that integrates image denoising algorithms, allowing users to select different algorithms to denoise images by themselves. Here are my questions:

However, different algorithms require different environments. How can I handle all environments within the application so that users don't need to configure the environments themselves? Are there any other methods besides using Anaconda to manage all versions and Docker containerization? How to solve the problem that the generated executable file (.exe) is too large?

I have tried packaging the environment for each algorithm separately using Conda, but the generated . The main version issue is that some algorithms use Python 2.7 and PyTorch 0.41, while others use Python 3.8 and PyTorch 1.13.1. Additionally, there are differences in the versions of OpenCV and TensorFlow.
Reply
#2
Hi,

Before proceeding with your project, I would suggest to think about your Python versions. Python 2.7 ist EOL since 1.1.2020, Python 3.8 since Ocotber 7th 2024. It is highly recommened to build new software for supported Python versions only.

On your question: what do you mean by "environments"? Do you probably mean "dependencies" = other Python modules? Dependencies can be handled via the "requirements.txt" file (https://pip.pypa.io/en/stable/reference/...le-format/) or, more recently, the pyproject.toml (https://packaging.python.org/en/latest/g...ject-toml/) file.

In the kind of strange and typically unlikely event to algorithms have conflicting requirements, you can't pack them into one Python module. But, as said, this is an extermly rare corner case and typically hints towards that old to outdated releases of a third-party Python module are required.

Regards, noisefloor
buran likes this post
Reply
#3
Using conda you make a .yml file that can by used on a other pc.
conda create -n myenv python=3.8.13
conda activate myenv
conda install numpy pandas matplotlib .....
# Export the Environment to a File
conda env export > myenv.yml
Copy the YAML File to the other PC,or make a GitHub Repo wit code.
conda env create -f myenv.yml
conda activate myenv
Python 2.7 is removed from all package mangers,so just trouble if have to use it.
Find older stuff like Docker container or older version of Anaconda.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  MPEG DASH Package implementation similar to M3U8 package anantha_narayanan 1 2,105 May-05-2025, 08:34 AM
Last Post: pintailscratchy
  Windows, Linux and virtual environments Calab 2 1,121 Mar-07-2025, 10:43 PM
Last Post: snippsat
  Python use of virtual environments bre67e49 4 1,790 Feb-19-2025, 04:01 AM
Last Post: Sece1967
  Best practice on using virtual environments in Python bytecrunch 6 33,654 Feb-14-2024, 03:22 PM
Last Post: snippsat
  How to run utilities from a Python package? LugosisGhost 1 1,849 Dec-27-2023, 12:00 PM
Last Post: Larz60+
  Python package not seen in VSCode fmccabe80 6 13,696 Mar-06-2023, 10:01 PM
Last Post: fmccabe80
  Virtual Environments - Organization (VS Code) JaysonWonder 11 5,737 Jan-26-2023, 11:34 PM
Last Post: Larz60+
  Keeping up with IDEs and Virtual Environments... bytecrunch 7 11,604 Sep-05-2022, 08:04 PM
Last Post: snippsat
  I don't understand pip and environments snakes 3 3,048 Jul-31-2022, 08:17 PM
Last Post: snakes
  Math Package in python Uma 1 2,498 Dec-12-2021, 02:01 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020