I'm defining an update procedure on the air-gapped standalone RedHat7 server with the preinstalled python3 and
basic packages.
The python3 applications are developed on a host with an Internet access, and are delivered to this standalone
server using DOK.
Additional packages can't be installed using pip, but must be trasfered from development host to the local user's home directory.
I'm looking for a proper way to update and activate python3 applications on this standalone server, without appending a new package path using sys.path.append("/home/user/packages/pack_N") before importing it.
Thanks
Zeev
I'm assuming you meant without using "PyPi".
Downloading the packages can be done with pip wheel <package> after installing the wheel package.
Installing them locally without using pip's servers (PyPi) can be done like so:
pip install <package> --no-index --find-links=<directory containing wheels>
Related
I want to install https://github.com/opendoor-labs/pyfin package in windows 10, but no pip installation method is provided in the page. I use vs-code python-3.9.10 and all my libraries are installed in a virtual environment. The git address of all files is https://github.com/opendoor-labs/pyfin.git. but I don't know how to download and install directly to the (venv). Is there any easy way to install and import it to my code? I tried 'pip install pyfin', but it installed other library included in this page : https://pypi.org/project/pyfin/ which is different.
First activate your venv.
(activate it using the .\venv\Scripts\activate command.)
The run pip install git+https://github.com/your/repo
I am new in python. I am creating an API in python using flask-restful. I have created APIs in java.In java we have pom.xml file for dependencies...is there any for python and flask-restful
Yes. In python We generally make requirements.txt so anyone who wants to download all the requirements can simply run the command
pip install -r requirements.txt
so if you are using virtualenv you can simply do
pip freeze > requirements.txt
Otherwise you need to add all the dependencies manually & the requirements.txt file will looks like
decorator==4.3.0
defusedxml==0.5.0
entrypoints==0.2.3
Flask==1.0.2
google==2.0.1
Note: It's just for example.
I would recommend using pipenv.
In Java, you need to know where your library dependencies are located and they usually are downloaded once for each project as you need them. In other words, each project will have their own set of plugins. This is also the same for non-global NPM packages (package.json), Ruby gems (Gemfile), and so on.
But in Python, everything you install with pip is global. Anything you install with pip will make your system Python installation messy at best and at worst will not be portable between developer machines. We get around this problem with the concept of a virtual environment which more or less is a copy of whatever Python version you're using self-contained to a project.
pipenv works pretty similarly to npm.
You initialise with pipenv --three and use pipenv install Flask (for example) to install packages and keep track of them in Pipfile.toml and a lock file. You can then clone it on another computer and pipfile install to install all dependencies.
If this tool does not work for you, you may also want to try pyenv and virtualenv and use a requirements.txt file as suggested by Rahul.
Hope that helps!
I am working with Python 3.6 and I am having a project for which I created requirements.txt file using pipreqs. But when I run pip install -r requirements.txt, the build fails because a specific library GDAL can be installed only using those three commands:
conda create -n gdal_test python=3.5
activate gdal_test
conda install gdal
What is the best way to deal with this if I want everyone to be able to install things without issues on different local machines and different EC2 instances on AWS and using microservices? Obviously only running requirements file is not going to work. Is Docker a solution? If so, how? Do I also need a setup.py file? Thanks.
Objective -
To install lxml on the machine without pip
Issue
Due to my company firewall and lack of admin access, I am not able to use pip. It throws an error. Hence I am not able to install pip
Steps taken till now
On my development machine(windows 7), I dont have admin access hence I cannot use pip or easy_install. For BeuatifulSoup & requests, I downloaded the source and put the source in Python34 -> Lib folder. For lxml as well I have downloaded the source file and put it under Lib folder but I still get the same error.
Please note, I cannot ask for Admin access, because its my personal project and my organization will not provide admin access for personal project.
Hence, I want to know how can I install or use lxml on my system.
lxml is at least partly coded in C, and putting C source in /Lib does not work, as you found.
If you are allowed, download a Windows installer and install for 'this user only'. It would probably work better to use 3.5.1, to avoid clashes with the already installed 3.4. You could then use pip to install packages.
I'm starting a Pyramid application on OSX which will eventually be deployed on Ubuntu. The application will need packages such as boto and pymongo. What do I need to do to make the application easy to deploy on Ubuntu?
Just follow any of the tutorials pyramid provides using scaffolds either on OSX and on Ubuntu. This will show you how pyramid application requirements are managed. It is abstracted by defining requirements in setup.py or requirement.txt for example.
SQLAlchemy + URL Dispatch Wiki Tutorial
ZODB + Traversal Wiki Tutorial
Really, all you need to start to be productive with pyramid is here
Getting Started
After finishing your application you may distribute a source distribution/archive (*.tar.gz)
Distribute your application
Install your application on Ubuntu with pip and pass the path to your local source archive. You need to install your package into development mode either using pip or setuptools. Below you will find the --editable option from pip:
$ pip install --help
Usage:
pip install [options] <requirement specifier> ...
pip install [options] -r <requirements file> ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
Description:
Install packages from:
- PyPI (and other indexes) using requirement specifiers.
- VCS project urls.
- Local project directories.
- Local or remote source archives.
pip also supports installing from "requirements files", which provide
an easy way to specify a whole environment to be installed.
Install Options:
-e, --editable <path/url> Install a project in editable mode (i.e.
setuptools "develop mode") from a local project
path or a VCS url.
I recommend to use virtualenv to isolate your work on any platform.