Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I came across a python library which has docs, which start like this:
Quickstart
Include foolib in your requirements.txt file.
AFAIK dependencies should be specified via install_requires in setup.py.
Should I talk the maintainer of the library and create a pull-request for the docs?
Both are acceptable. The difference is that specifying something in your install_requires will auto-download / install that package when you install the package using setup.py. Having a requirements.txt makes it easier to see at a glance what the requirements are. I personally prefer seeing libraries with a requirements.txt, since I can install all those requirements with pip into my virtualenv and be able to update them quickly if needed.
Add your dependencies in a requirements file and then parse this file in the setup.py. This will help you to:
Easily install dependencies without installing the entire package through pip
Get only one source for your dependencies
Get all way to install your package available (pip, easy_install, command line, etc...)
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
Using machine learning models always come with some dependicies like framework or library verison conflicts. And pip verison as getting up, installing some libraries could be suck. What is your pip version? Do you upgrade it always?
It is quite ok if the version is not updated to the latest on every single release.
You will hardly get any problems even if you update the pip every 3 to 4 months.
However I recommend that you should update the pip every month or at least when a major update comes.
For Linux users, If you have a habit of updating your system every month than you should not worry about this explicitly.
first of all, there is no dependency management with pip. Most people use conda as a package manager for python because it automatically checks for dependency compatibility. If you use pip as a package manager you have to do all that yourself which is difficult if not impossible unless you have a ton of sys-admin experience. If you are running into dependency issues I strongly recommend downloading anaconda and using conda package manager. It will make your life a lot easier. cheers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I'm trying to install the requests library so I can make HTTP requests. I've tried looking for resources online but I can't seem to find tutorials for installing this library on MacOS.
In general, there's an executable file called pip inside the bin folder where you python is. (it might be called pip3 or something similar, depending on your python version and the distribution you are using). Put that on your system path, and then simply
pip install requests
I would personally go with pipenv (install it using pip install pipenv --user) and then run pipenv install requests in your source directory, to avoid conflicts between different projects.
You can use pip to install requests library. Try these steps to setup pip and install requests library in macOS:
sudo easy_install pip
pip install requests
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to install lightgbm using conda. I successfully downloaded the only version I saw on the cloud(2.2.1) and saw that it forced me to downgrade my mkl. I thought this would be ok, however, when I did this, it broke some other essential functionality (a matplotlib function stopped working).
I was wondering how I might resolve this issue? Also is there a general strategy people tend to use when dealing with this whack-a-mole type dependency problem? Is there something simple that can be done to handle this? Thanks in advance!
The general strategy people use for this problem is working with different environments. When you use different environments for projects, you can install packages for each project you work on seperately, and you will not get into trouble with packages not working anymore for your other projects. It works pretty simple and avoids dependency problems.
To create a new environment use: conda create --name env_name python=requiredpythonversion
Then you should activate your newly created environment: activate env_name
After which you can install to it the packages your project requires: conda install PACKAGENAME, in your case that would be conda install lightgbm
A great tutorial on how to work with python environments using conda (You could also use pip and venv's, but since you seem to be using conda already I assume you want to proceed with that), can be found Here. I recommend you follow it, it will probably answer all the remaining questions you have about package management, and then you will be good to go =)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
this is a pretty basic question but I'm not really finding any answer, maybe my keywords are wrong...
I've been programming in Python for a little while now and I made a few scripts that are good enough to be deployed in the department where I am working. So... Am I going to have to make everyone install Python on their machines, and then go through the tedium to install all the modules I use in the scripts with pip, or is there a better solution? Obviously I have zero experience with this, so far I've only been working on Visual Studio and running my scripts from there. I would appreciate a couple pointers, the topic is very broad and I feel lost.
It's possible to create a module, as if it's intended for pip, that you do not publish on PyPI, but allow people to install locally.
For example, observe this project on GitHub: pyjokes. It's available on PyPI so you can pip install it. But you can also download the repo and install from source. This would install it as if you'd installed it using pip (because pip is just a wrapper for "download this project and run the installer").
The procedure for installing this project from source would be:
git clone https://github.com/pyjokes/pyjokes
cd pyjokes
sudo python3 setup.py install # python 3
sudo python setup.py install # python 2
Take a look at the way the project is laid out. The essentials are the setup.py file and the __init__.py in the pyjokes folder. That should be enough to make your project installable locally.
Then you can distribute the code (perhaps a private github or bitbucket repository), and use the README to describe the installation instructions.
Note: I've described a Linux installation process, but I'm fairly sure it works the same on Mac too. I'm not sure about Windows.
Python official docs have a lot of info about this.
For 3.x.x Setup script
For 2.7.x Built dist
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
When I download a package and run python setup.py install, the package becomes importable. What does the command do that makes the code importable?
In most cases, setup.py installs code into locations already along sys.path (which may or may not exist along PYTHONPATH). It doesn't modify PYTHONPATH or sys.path.
Generally, the input paths listed in setup.py are assumed to be relative to the setup.py script. For packages and modules, the output paths (where files are installed) are assumed to be standard python install location for third-party packages for the current python interpreter.