Creating a "pen drive program" with Python - python

I'm bringing you this issue: I'm trying to create a program to run in Windows using PyQT, to work on a pen drive. My idea is: I plug my pen drive, and everything that I need to run the program is there, including Python 3, PyQT, etc.. I don't want the user to install all the requirements, I just want one executable that install all the programs necessary and then, there will be the executable to open the program. Considering, of course, that Python 3 is not installed in this Windows Machine
Just wondering how can I do it? Do you guys have any idea?
Thanks,
Gus.

Just an idea - not sure if that would work under your specific conditions (PyQT etc), but couldn't you run it from the pen drive directly? As in create a Python virtual environment (for example using venv, with all the dependencies) on the pendrive and then call your program using the python interpreter in the installed virtual environment.
Or use the virtual environment and it's interpreter to install the dependencies?

Related

How to use python console of pycharm with a poetry environment?

Context : I am trying to find the best environment to develop analytics ml project in python where I can both write my main pipeline functions as a script (and access variable through a console) and then do analytic on notebooks.
Each project is different and so I am defining new poetry env to settle the right python packages. At each step when running my script I need to be able to access the variables easily to debug and code faster. I am currently using pycharm as IDE, but I can't find a way to activate and use my poetry env when running a python file through the python console of pycharm. I can only choose the python version, but the packages used when running the python console seem to be the one installed globally on my computer. Being able to access variables through python console while still using poetry env would help me save a lot of time when developing my script.
If it's not possible to run python console on pycharm with poetry env, I might change IDE to go to VS Code, as some friends advice me to do. If you have any advice, I will take them gladly :) !
Thank you very much and have a nice day !

Run Spyder 5 Python installation in CMD

Rather than installing a version from python.org, I would like to have the CMD use Spyder 5's python installation.
I have done some digging and as I understand it I need to add python to the "Path" variable of my windows system. After adding the python.exe path C:\Program Files\Spyder\Python\python.exe and also trying C:\Program Files\Spyder\Python to "Path" in Environment Variables it made no difference and I receive the basic error:
> Python was not found; run without arguments to install from the
> Microsoft Store, or disable this shortcut from Settings > Manage App
> Execution Aliases.
As an additional detail I can open python scripts outside of Spyder after having selected "open with" and then selecting the python.exe file which is located in: C:\Program Files\Spyder\Python\python.exe. This is great but I definitely want to be able to run scripts from the CMD. I have also looked at C:\Users\Tech\AppData\Local\Spyder after looking at some my python installations my other machines but no python executables are saved there.
I have gone ahead and become well versed in how to setup virtual environments. I now set up virtual environments with the necessary libraries I need and simply have spyder use those. This works best for me as I can use easily install libraries that I need and switch environments if necessary. As plus for I can run the scripts in the command prompt easily which was the first issue that I ran into.
Spyder needs additional libraries installed to run with a custom virtual environment. On the first running it will crash and provide the pip command to install the necessary libraries.
I'm still improving my working knowledge of how to manage paths and environments. For now this works well for me and seems to be a step in the right direction.

My university's cluster doesn't connect to the internet, so I can't use conda to create an environment with python 2.7. What else can I do?

A code I wish to use requires python 2.7. I thought I'll make an environment just for this code but my uni's cluster [SUSE Linux] doesn't connect to the internet for security reasons. What other options do I have?
Install Anaconda on your PC in a known location (not the suggested ProgramData which is hidden and possibly protected)
Copy the Anaconda installation on to a memory stick
Create a directory where you are going to do your work on your cluster - say H:\Work
Copy the whole Anaconda installation to H:\Work
Create a shortcut to C:\Windows\System32\cmd.exe in H:Work
Change the properties to
cmd /k H:\Work\Anaconda2\scripts\activate.bat H:\Work\Anaconda2
I'm just guessing that it is Anaconda2 for 2.7. I use 3.7 which is Anaconda3.
Copy the shortcut to your desktop or taskbar or favourites
Use the shortcut to start anaconda.

Python: Installing virtual environment on network drive

I wrote a Python program that I use daily at work, and I was hoping to be able to pass it along to others who have zero programming experience.
I need to avoid having each user download Python and the relevant dependencies, and I also can't compile it into an executable.
I tried creating a virtualenv on a network drive, and made a .bat file that activates it and runs the script in the environment. It works for me, but other users get a "Can't find python34.dll" error when they try to run it.
Is there anyway around this? Am I going about this incorrectly? The goal is to have non-Python users be able to run the script without installing Python or compiling it all into a .exe.

Python: "No virtualenv active"

I installed PyCharm 2.7 under Windows 8.1. It works fine, but every time I run a program, I get the following warning:
WARNING:root:No virtualenv active
Why does it happen and how can I fix it?
Program you run needs a virtual environment to run. This is a nice python feature that allows you to isolate a python program within the scope of the specific python set of libraries it may need. If you do not run more than one Python program you may not be really worried about it. However, it you do, I would recommend to ready about virtualenv first.
ps. Also, it might be just a debug log for developers to make sure they switched virtual env.

Categories

Resources