Python Forum
installing any package= impossible headache
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
installing any package= impossible headache
#21
(Nov-05-2017, 02:16 PM)ineedastupidusername Wrote: Say packageA requires scipy version 1.0 and packageB requires scipy versioni 1.1.
This typically is not a problem since most packages are backward compatible, if only within the major version. The best thing you can do (at least I do) is to run pip list --outdated from the command line. This lists any outdated modules. If there are any, simply run pip install --upgrade package_name

There are three main things to keep in mind with Windows vs Linux, Mac and *nix.
  1. Windows does not, by default, support utf-8, it uses code pages (what unicode Windows does use is utf-16)
  2. Windows does not come with a compiler pre-installed.
  3. Windows does not rely on Python...at all
Item 1 was resolved (at least with Python) with Python 3.6 (see PEP 528 and 529)

Item 2 is resolved (in many cases) by the https://www.lfd.uci.edu/~gohlke/pythonlibs/ web site, which has helped the Windows community a great service by pre-compiling many of the third party library's, like 'scipy'.

Item 3 means you can install and uninstall Python as often as you like, and it will not affect the operating system.

Simply trying to copy and paste a bunch of files into a directory would create a nightmare situation, the likes of which the world has never seen.
Quote:If not, your package becomes obscure and nobody uses it

You're right. If you are the publisher of a library, and you do not maintain it and ensure that it complies with the current standards, it will indeed become obscure. That has nothing to do with a 'monopoly' by pip.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#22
Quote:Simply trying to copy and paste a bunch of files into a directory would create a nightmare situation, the likes of which the world has never seen.

Even if each package is organized in its own folder (not just a jumbled mess of random files)? Like to install pygame would just be a single copy/paste of the whole pygame folder. Moviepy would be a paste of a moviepy folder, then also another copy paste of all the dependent folders, like an imageio folder too etc. That would only be like 5 or whatever copy pastes needed to install moviepy with all its dependencies, and seemingly simplified to the easy task of pasting them all into whatever folder you want (like maybe c:\python27). Maybe when importing you could specify a path even like instead of "import pygame", "import c:\python27\pygame". Like I doubt I'd use 30% of all 100 anaconda packages, so if packages could be downloaded easily like that on an as need basis it seems like it'd be simpler, to me at least, but again I don't know much about how it all works.
Reply
#23
(Nov-05-2017, 03:15 PM)sparkz_alot Wrote: Simply trying to copy and paste a bunch of files into a directory would create a nightmare situation, the likes of which the world has never seen.
Yes,i did write a little about here under The Dark Age and the Broken past.
As i mention Python packaging was messy state between around 2008 to 2013.
So there where a lot of bad homemade solutions.

In 2013 did PyPA(Python Packaging Authority) formed.
They overview and develop tools like pipsetuptoolsvirtualenv, and wheel.
So they only way forward is to improve on these tool,and educate people how to use theme.
Developers also need a little kick to not forget Windows,Python is a Cross-platform language Wink

So all these tool is now build into Python,also virtual environment in Python 3.6
Many new user do uninstall Python if they get a error and try to reinstall.
Virtual environment is build in(3.6) and this make it easy to get new isolated Python version.

Example with moivepy:
# Make virtual environment
C:\1>python -m venv moviepy_env

# cd in
C:\1>cd moviepy_env

# Activate virtual environment
C:\1\moviepy_env>C:\1\moviepy_env\Scripts\Activate

# Check that pip in environment is used
(moviepy_env) C:\1\moviepy_env>pip -V
pip 9.0.1 from c:\1\moviepy_env\lib\site-packages (python 3.6)

# Install moviepy
(moviepy_env) C:\1\moviepy_env>pip install moviepy
Collecting moviepy
  Using cached moviepy-0.2.3.2-py2.py3-none-any.whl
Collecting numpy (from moviepy)
  Using cached numpy-1.13.3-2-cp36-none-win32.whl
Collecting tqdm==4.11.2 (from moviepy)
  Using cached tqdm-4.11.2-py2.py3-none-any.whl
Collecting decorator==4.0.11 (from moviepy)
  Using cached decorator-4.0.11-py2.py3-none-any.whl
Collecting imageio==2.1.2 (from moviepy)
Collecting pillow (from imageio==2.1.2->moviepy)
  Using cached Pillow-4.3.0-cp36-cp36m-win32.whl
Collecting olefile (from pillow->imageio==2.1.2->moviepy)
Installing collected packages: numpy, tqdm, decorator, olefile, pillow, imageio, moviepy
Successfully installed decorator-4.0.11 imageio-2.1.2 moviepy-0.2.3.2 numpy-1.13.3 olefile-0.44 pillow-4.3.0 tqdm-4.11.2

# Install SciPy wheel from Gohlke
(moviepy_env) C:\1\moviepy_env>pip install scipy-1.0.0-cp36-cp36m-win32.whl
Processing c:\1\moviepy_env\scipy-1.0.0-cp36-cp36m-win32.whl
Requirement already satisfied: numpy>=1.8.2 in c:\1\moviepy_env\lib\site-packages (from scipy==1.0.0)
Installing collected packages: scipy
Successfully installed scipy-1.0.0

(moviepy_env) C:\1\moviepy_env>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import moviepy
>>> moviepy.__version__
'0.2.3.2'
>>> exit()

(moviepy_env) C:\1\moviepy_env>
So now have a totally isolated version,this give several advantages not just if the are problem with Os version.
Also if need to package and share stuff,it's good to have a stuff isolated as a start.
Reply
#24
Quote:Like to install pygame would just be a single copy/paste of the whole pygame folder. Moviepy would be a paste of a moviepy folder, then also another copy paste of all the dependent folders, like an imageio folder too etc. That would only be like 5 or whatever copy pastes needed to install moviepy with all its dependencies, and seemingly simplified to the easy task of pasting them all into whatever folder you want (like maybe c:\python27). Maybe when importing you could specify a path even like instead of "import pygame", "import c:\python27\pygame".


When you import...
1) It first looks in the current directory of the root script. Any module here overrides any other of the same name later.
2) Then it searches the PATH directories. (defined user and platform specific directories)
You can add a custom directory on the fly with
import sys
sys.path.append("/path/to/your/directory")
So you could put the pygame directory where ever you want (assuming you have its dependencies such as SDL) and just add that parent directory, then just import pygame....but no one really does that as its against the grain. It is much easier to put pygame in the default 3rd library location. And pip installs it to that as well as maintains updates, uninstall, etc. you could also manually "copy" the pygame directory. If you really want to manually install a script i have a tutorial here. But i would not recommend it for you as it will lead you astray more.

Another thing regarding 3rd party libraries. Is that is all they are....3rd party libraries. They are not maintained by python.org. They are individually built and maintained by numerous people of the python community. pip just brings a method of sanity to it all of them. If one module (ahem moviepy) wants to install dependencies only when you use it instead of just installing them all at one go, then they have a right to do that. It is "their" library, not python's. I believe the reason they do that is because ffmpeg is well known but consider to some to be dated, as well as some people prefer specfiic version of ffmpeg. Some people might not want to install a dependency of a library if they are not using that part.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  trouble installing python package Tuxedo 1 3,166 Apr-07-2021, 09:07 AM
Last Post: Larz60+
  Installing package in Anaconda on an Intranet Computer Secret 1 1,901 Sep-17-2020, 02:16 PM
Last Post: Larz60+
  Error when installing Seaborn package using pip chawkins 3 5,541 Jul-16-2018, 12:12 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020