Installing py2exe python module offline - python

I've been trying to install the py2exe module (for Python 3) offline (it's a stand-alone network) without without installing any dependencies first (I couldn't find a list of dependencies anywhere).
When I try to install it, it runs into a module exception :
no module named py2exe_distutils
The file is in a .tar.gz format.
I use the pip install file in cmd while being in the file directory.
I would appreciate any help regarding this.

I think you need this:
https://github.com/py2exe/py2exe/releases/tag/v0.10.4.0
this file contain the offline setup 😁
image

Related

How to deploy a Python program to a computer that's offline?

I have a small python app I've developed for file validation. I need to deploy it to a server that has no outside internet access. It utilizes a number of libraries (pandas, glob, os, datetime, pyodbc and numpy).
I was able to install Python 3.8.5 on the server and I attempted to use Pyinstaller to wrap everything including the libraries into a nice exe that could run on the server but it did not work. I am trying that again using the --onefile flag. Error message below:
Traceback (most recent call last):
File "BDWtoStuckyValidation.py", line 2, in <module>
import pandas as pd
File "C:\Program Files\Python38\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
dateutil: No module named 'dateutil'
The server is completely offline - I cannot simply use PIP to install the libraries that are missing. Additionally, my work computer is VERY locked down so I also cannot simply download WHL files or similar and manually install them on the server. Anything that has to be transferred to the server would need to be downloaded on my personal laptop, transferred to my work laptop via bluetooth and then to the server via the network. I did just run pip download for my needed modules on a machine with internet access, bundled the whl files into a tar.gz file, transferred that to the server in question and it still wouldn't install when attempting to run pip install tar.gz Update: I unzipped the tar.gz file and attempted to install some WHL files manually, it got stuck on pandas, attempting to download something or connect to pypi.org, which it obviously can't.
Any help would be appreciated.
The process you described should work, but you need to ensure that you get all of the indirect dependencies (the things that your direct dependencies depend on). A good way to do that is via a tool like pip-compile (part of pip-tools), where you can declare your direct requirements in a requirements.in file and have it figure out the complete list of dependencies and versions (written in to requirements.txt, generally). Once you have that list, you can download all the appropriate wheel files and proceed just as you described.
The reason that it would not work with your .tar.gz file is that pip expects a .tar.gz file to be a source distribution for a single package, rather than a tarball of a bunch of different wheel files for many packages.

Python Module Installation from Folder

I downloaded a project and am running through and installing all dependencies. At first I had errors regarding No module named utm and No module named paho. I solved these issues by going to C:\Users\me and using pip install paho-mqtt and pip install utm. Easy enough.
I then have this line "from mfa_msgs import Mission, WaypointList, MissionControl, ControlCommand, Status" and am getting a No module error here. mfa_msgs is a folder found in the project I downloaded that contains the Mission, WaypointList, etc. files. Where do I need to put the mfa_msgs folder in order to be able to access them?
Appreciate your time!

Can you install a python file from git as a module?

I am currently interested in installing the following git repository:
https://github.com/CodeReclaimers/neat-python/tree/master/examples/xor.
It contains a file called visualize.py and I would love to just install and use it as a module (e.g. numpy). However, I'm not sure how if it is possible to do this and was, therefore, hoping anyone could clarify this for me.
I have tried:
pip install git+https://github.com/CodeReclaimers/neat-python/tree/master/examples/xor
Any help would be appreciated!
Edit:
I was able to clone the entire repo:
pip install git+https://github.com/CodeReclaimers/neat-python.git
Does this mean I should be able to use all the files available in this repository as a module or is there something I'm still missing? I still cannot use visualize as a module. Thanks!
If you are able to clone the library to the same directory, you can simply import the python file without pip installing as module.
For instance if the file is called myFile.py, you can call the following and the entire file is executed and functions within can be used.
import myFile
1- open directory with modules
example : c:\users\james\appdata\local\programs\python\python39\lib
2-New python file created
example : visualize.py
3- save the python file.

I have created pyd file with SWIG and want it to be installable

I have created a simple python module with SWIG (from C++). It is in the form of a .pyd file and a .py file.
I want to be able to give this module to my colleagues so they can install and use it.
I am aware that python modules are often installed using:
python setup.py install
Perhaps this is the functionality I want, so that my colleagues can run this module from anywhere without worrying about PATH etc.
I also would like to be able to send them an updated module from time to time, which will overwrite the older version when they install it.
How do I go about this?
As far as I can understand this question, you want a setup.py file to install your module
go through the steps given below :
create a directory on Desktop (name it "source" for example)
put your .py and .pyc files in it.
go to Desktop and create setup.py file and enter the following code
as
from distutils.core import setup
setup(name='Some_name',
version='1.0',
author='Author_name',
author_email='abc#xyz.com',
packages=['source']
)
4. To use it in any program.
import module_name from source
hope this helps !

Python doesn't install modules?

I can't seem to get a module installed with Python 2.7.3, or well, a lot of modules in fact. When I download the module, and then run "python setup.py install" from the folder, it looks like it installs - however, trying to import the module does not work. So, I went ahead and looked in site-packages - the only thing I found was the .egg file, which is not helpful in any way. Then, I did a search for the module in the entire folder of Python2.7, results: the .egg file and something totally unrelated. I have gotten some modules installed in the past (twill, BeautifulSoup, and a few others), some partially installed (pyglet, installed and in the folder, however running doesn't work) and then there's a whole load of modules that just don't install. They create a .egg file and that's it. Done. Nothing else. It's really annoying, so I'm wondering what could cause the issue?
The module I was trying to install was the feedparser module.
Edit: After doing >>>help() and then modules, it's not showing up there either.
You can use pip as a module (package) manager, better that installing things manually.
http://www.pythonforbeginners.com/basics/python-pip-usage
Plus using virtualenv is a good practice.
http://virtualenv.readthedocs.org/en/latest/virtualenv.html

Categories

Resources