LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-26-2018, 02:01 PM   #1
intmail01
Member
 
Registered: May 2013
Posts: 91

Rep: Reputation: Disabled
How to force Python to use newest version of package


Hi,

I install a python application which required several packages. I am not a python programmer and use command
Code:
python setup.py install
for each package.

After installing all needed packages, the main application dont find them and expect the isntallation of exact version. I downloaded and installed the most recent version for all required packages.

I dont want to download again. My question is how to force the installation process to use the newest version that I have already installed.

Thanks
 
Old 01-26-2018, 02:37 PM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Here's the relevant page on installing Python packages:

https://packaging.python.org/tutoria...ling-packages/

I usually use pip to install my Python packages and it works well.

Note that if you are using a distro which has both Python2 and Python3 installed, you will need to use pip3 for Python3 packages. For my Linux Mint setup, I usually use sudo -H pip3 when calling pip3 but your mileage may vary depending on your distro.
 
1 members found this post helpful.
Old 01-26-2018, 02:43 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,246

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
If you're describing what I think you're describing: there's a metadata file in the "main application" that describes which versions of which dependencies it needs. To get "the main application"'s setup scripts to tolerate the versions you have installed, you would edit "the main application"'s metadata files.

The metadata is described here:

https://svn.python.org/projects/sand...oc/formats.txt

Obviously, this is not a good idea. It will result in an unsupported, untested setup for "the main application".

If "the main application" includes a file called "requires.txt", then you could have installed the correct versions of all its dependencies with:

Code:
pip install -r requires.txt
And if "the main application" is on pypi, then you could have installed it and the correct versions of all its dependencies with:

Code:
pip install <name of main application>
You chose not to name or link to "the main application", so this is as specific as I can get.

Last edited by dugan; 01-26-2018 at 02:58 PM.
 
1 members found this post helpful.
Old 01-26-2018, 07:19 PM   #4
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Try running this in the terminal:
Code:
python -c 'import sys; print("\n".join(sys.path))'
sys.path is the directories python will examine to see if there is a module to import.

Did the setup.py tell you where it installed it to? Did it install it to any of these directories?
 
Old 01-26-2018, 07:26 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,246

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
@Seyfir: it sounds like the "main application" was a Python wheel, and it refused to install because he'd installed the wrong versions of its dependencies.
 
Old 01-26-2018, 07:54 PM   #6
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Didn't even know what wheels are, but there they are.
After looking at the PEP, wheel files shouldn't even include a setup.py? Going off of that, it seems like a python setup.py install command should fail
Trialling the simplejson wheel didn't reveal any setup.py file.

Quote:
Wheel does not contain setup.py or setup.cfg.
Wheels are completely new to me, so I may be off on the above.
 
Old 01-26-2018, 09:28 PM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,246

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
No, he only said he installed the dependencies using setup.py.

He didn't say how he tried to install "the main application". If he tried to install it with "pip install /path/to/main_application.whl", then it will check dependency versions and refuse to install if they're wrong.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] What is the safest procedure to update stock Libreoffice version provided with Mint distro to newest stable version? mlytle Linux Mint 1 08-20-2017 04:39 PM
[SOLVED] Which Damnsmalllinux version has the newest ndiswrapper and wpasupplicant version? floppy_stuttgart DamnSmallLinux 3 10-06-2011 01:40 PM
Which LXDE version of Linux has the newest version of Firefox and Open Office? coolguy2008 Linux - Newbie 6 09-19-2010 12:04 PM
LXer: A look at the newest Python Metaprogramming LXer Syndicated Linux News 0 01-09-2007 03:54 PM
Cannot Force Package Version e_guillaume Linux - Software 0 09-26-2006 05:49 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration