Install github clones of a python package to WinPython - python

I'm trying to install a package, pybrain, from its github website. It does not have nicely packaged archive files or executables, so I don't know how to install it via WPPM.
Do I still do python setup.py install, or do I copy the pybrain folder manually to the site-packages? I figured one thing I can do is to
python setup.py sdist
to generate an archive file, and then use WPPM to do it. Is this the "best" way?
Thanks in advance!
PS: Sorry that I don't have enough reputation to initiate the tag of "WinPython".

Most packages that are configured properly with distutils will automatically place themselves in the correct location with "python setup.py install"

Having had similar issues, especially sitting behind a corporate firewall, I found the easiest way to install things from github repositories is to download the repository as a zip file, then use the WPPM to add the package from there. Github repositories give the option of downloading as a zip on the right hand side. I've found that the package manager handles everything correctly from there.

Related

Pip install doesn't install any .py files

The issue: I ran pip install pyshp, but could not import it into my python project. When I check the package in my site-packages folder, I see it installed as 'pyshp-2.1.0.dist-info'. When I look at what's inside that folder, I only see the following files: INSTALLER, LICENSE.txt, METADATA, RECORD, REQUESTED, top_level.txt, and WHEEL. I don't see a single .py file. When I download the package manually from the pyshp download page, the folder has a bunch of other files, including the shapefile.py file that I need. So it seems like the download is getting stuck somehow. I've also tested and encountered this same issue with Pillow and Matplotlib, so I think it's something with my Python setup, not an issue with the package itself.
I'm fairly new to Python, does anyone know what I've done wrong? Or any other ideas? Thanks for your help in advance.
Edit: To be clear, I'm not trying to fix the pyshp install issue directly, but instead figure out why the install process isn't working for all of the packages I'm trying to install.
Go to your site packages directory, it is in the root of the site packages directory. So copy and place it in the same directory beside your python script, and you can import shapefile

Is there any way to Install packages on python for the Casio Cg50 Calculator?

I've recently been looking into emulators (and purchase) of a Casio CG50 Calculator. It has an option to run python, and I think runs on micropython. It obviously doesn't have pip, so I was wondering if there was any way to import external modules and packages, maybe by installing the git repo for a package? Thanks.
Download link for Casio Cg50 Emulator
When you need to manually install a library, you can just copy the file from the Repo to your project.

Importing libraries

I have a general question using third party libraries, but I will exemplify it on two examples to make it clearer and more "answerable":
I want to use pyfmi in Python. Trying to install it through pip tells me:
"Exception: FMI Library cannot be found. Please specify its location, either using the flag to the setup script '--fmil-home' or specify it using the environment variable FMIL_HOME."
I figured out that I had to download the tar.gz from jmodelica.org and extract the files, create a build directory, use cmake, make and make install commands. All runs through without a hitch. But trying to install through pip gives me the same error message. So my question is:
How does one do this? Do they mean by setup script the setup.py file? How can I access that one if I am installing through pip?
An which one is the fmi home directory? Is it the untarred file in my Downloads-Folder or one of the files in it:
builddir
Config.cmake
install
src
Test
ThirdParty
CMakeLists.txt
FMILIB_Acknowledgements.txt
FMILIB_License.txt
FMILIB_Readme.txt
LICENSE.md
README.md
? What is that flag and where to put it "exactly".
Thanks a lot.
PyFMI requires (as noted on the PyPI site) that FMI Library is installed prior to trying to install PyFMI from source.
During the installation (invoking python setup.py install) of PyFMI, the environment variable "FMIL_HOME" is checked to see if that points to an installation of FMI Library, if so, this will be used during the installation. So in your case, you need to set this environment variable. The other option is to install manually (using python setup.py install --fmil-home="/path/to/fmil") where the added path should point to FMI Library.
The third option is to see if there are binary installers for your platform (these include FMIL). Check PyPI, Anaconda and Christoph Gohlke's site.

How to install python from source without internet connection?

I'm installing python on custom location on a internal server.
Unfortunately, I can't make full internet connection here. Most of sites are block by firewall. (essentially pypi repository!) Please don't ask the reason. And I don't have root account, so I have to install python from source.
I did install python from source successfully! But the problem is any of easy_install or pip is not installable because the sites are not accessible form here. :(
How can I install them under current situation?
Download the source tarballs of the module you are interested in to your PC
Upload it to the remote server (SCP)
Extract the tarball (eg. tar -xvzf pack.tar.gz)
Set the current directory to the extracted folder (should contain a file named setup.py)
Install the module: python setup.py install (See documentation)
In my eyes setting up a local mirror like proposed by Tim is not worth of it (Of course this depends on how often you plan to install/update Python modules on that remote machine...)
Download the source tarballs of the relevant modules and install them locally.
easy_install /your/file/location/pack.tar.gz

distutils setup.py and %post %postun

I am newbie.
I am buidling rpm package for my own app and decided to use distutils to do achieve it. I managed to create some substitue of %post by using advice from this website, which i really am thankfull for, but i am having problems with %postun.
Let me describe what i have done. In setup.py i run command that creates symbolic link which is needed to run application. It works good but problem is when i want to remove rpm, link stays there. So i figured that i should use %postun in spec file. My question is: is there a way to do this in setup.py or do i have to manually edit spec file?
Please advise or point me some manuals or anything.
Thank you
Yes, you can specify a post install script, all you need is to declare in the bdist_rpm in the options arg the file you want to use:
setup(
...
options = {'bdist_rpm':{'post_install' : 'post_install',
'post_uninstall' : 'post_uninstall'}},
...)
In the post_uninstall file, put he code you need to remove the link, somethink like:
rm -f /var/lib/mylink
Neither distutils nor setuptools have uninstall functionality.
At some point, the python community agreed that uninstall should be handled by the packaging system. In this case you want to use rpm, so there is probably a way inside of rpm system to remove packages, but you will not find that in distutils or setuptools.
# pycon2009, there was a presentation on distutils and setuptools. You can find all of the videos here
Eggs and Buildout Deployment in Python - Part 1
Eggs and Buildout Deployment in Python - Part 2
Eggs and Buildout Deployment in Python - Part 3
There is a video called How to Build Applications Linux Distributions will Package. I have not seen it, but it seems to be appropriate.

Categories