Python Forum
Determing packages needed by a script: Creating a Miniconda environment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Determing packages needed by a script: Creating a Miniconda environment
#1
Hi
I have been given a bunch of python scripts, and want to create a Miniconda environment which contains all needed packages for the successful execution of those scripts.
The idea is to finally use Pyinstaller to create a self executable application with all required packages.
How do i figure out all the packages / modules needed by the scripts?
Based on that , i will create an environment in Miniconda with the required packages.

Thanks for any help / pointers

Best Regards
Ani
Reply
#2
That is very broad question
(Jan-27-2020, 06:21 AM)ashevade Wrote: I have been given a bunch of python scripts
Normally whoever wrote the scripts should provide a documentation (incl. installation instructions and required third party packages to be installed in advance). Possibly there could be requirements.txt file that can be used to install third party-packages.
Possibly if there is setup script there should be required packages listed in it too (and installed when you run the setup).

If the scripts are currently running on your/some system you can use pip to list the installed packages/export the installed packages in requirements.txt (note that there might be installed packages that are not used).

There is modulefinder.

Of course you can visually examine/search all the source code and find the imports. If the imports are not listed at the top of each module it could be tedious job.

You can run the scripts and see what error they will throw (note that that require to run/test all the code). But if the author didn't bother to document properly how you can be sure it's been tested properly anyway?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  a script i am thinking about creating Skaperen 2 2,691 Feb-28-2018, 02:18 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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