Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Can't decide - install modules with Ubuntu package manager (apt) or pip3 in venv
#1
Hello python community,

I'm a relative noob in linux (Ubuntu) and python who needs to downclock my gpu using WattmanGTK: https://github.com/BoukeHaarsma23/WattmanGTK, that requires matplotlib, setuptools, python3-gi, and python-3 cairo. This is also my first time installing something like this in this way from github.

I've read extensively over the past couple of days, enough to understand the general differences between using apt (Ubuntu package manager) and pip and the utility of venv. However I have no experience and knowledge as reference to make a judgement call on whether it's only necessary for me to simply install the modules with apt or if it's worthwhile and I'm better off installing them with pip3 in a venv to avoid any potential future version or dependency conflicts, the likelihood of which I'm unsure of since being new to linux, I don't know what are the chances that I will need to use another program which requires conflicting versions or dependencies.

So my main question is:

1. Should I use apt - Ubuntu's package manager to install the modules globally, or pip3 to install the modules in a venv, and why?

I have a few follow up questions, if you don't mind answering, to clarify if I'm understanding correctly:

2. My understanding is that as long as you avoid giving pip root access - sudo pip in Ubuntu - you will avoid the possibility of inadvertently altering system files and breaking the OS. Is this correct?

3. My understanding is that venv is the only way to avoid conflicts. Installing different versions in root (sudo apt) and in a non-root directory (pip -user) both provide global access and does not avoid conflicts. Is this correct?

4. This may seem obvious but I just want to be sure: If I were to install the modules in a venv, I assume that I will have to clone the repository for the program (WattmanGTK), install it and run it from in the venv. Is this right? This bring me to the last question:

5. With reference to Q4, is there a way to access a graphical interface of the venv through the file manager so you can actually see what files are in it. i.e. could I see the repository for the program after putting it in the venv? Or is it only possible to access and interact with the files in venv through command line?

Thank you very much in advance.
Quote
#2
If from PyPi, use pip otherwise apt-get
Quote
#3
I usually install globally and never use virtual environments. That is because my linux partitions are repetitively deleted with a new installation of a distribution quite often. So i have no comment on their use as i never use them.

It should be noted that pip3 does not instantaneously install it to a virtual environment. If your not in one, then it will install to your OS python. You should always use pip to install to python in today's world.

If you plan on using different programs with different dependencies of the same python version, then you might want to use virtual environments, as its easier to handle a multitude of them. But if your just starting out learning its a smaller chance that you would need it. It really depends on what you are doing though.

I would also be more inclined to use virtual environments in Windows as opposed to linux. Especially in a distribution that is not a rolling release. As the slate is wiped clean every install. But again, that depends on what your actually doing.

These questions should be answered on our tutorial. If not, then it should be added.
Quote
#4
Thanks for the feedback metulburr.

(Jul-19-2019, 02:54 PM)metulburr Wrote: I usually install globally and never use virtual environments. That is because my linux partitions are repetitively deleted with a new installation of a distribution quite often. So i have no comment on their use as i never use them.

If you're frequently deleting and installing distros, it's fair enough that you install globally since you're less likely to run into conflicts. I don't have any intention of reinstalling Ubuntu or changing distros for the meantime until I get a new pc, which hopefully will happen within the next year.

(Jul-19-2019, 02:54 PM)metulburr Wrote: If you plan on using different programs with different dependencies of the same python version, then you might want to use virtual environments, as its easier to handle a multitude of them. But if your just starting out learning its a smaller chance that you would need it. It really depends on what you are doing though.

And this is the crux of my difficulty. Since I'm new to linux and python, I have no idea how likely it is that I will need to use other programs with conflicting dependencies. For now, I just want WattmanGTK to work so I can downclock my gpu. If installing it with a venv avoids future problems, then great, but for all I know, I may not even use any programs that cause conflict and I'd just be overcomplicating things with venv for nothing.
Quote
#5
If your just planning for WattmanGTK, then i wouldnt bother with virtual environments until you need it. You can always uninstall it later if you use virtual environments later on. Thats my opinion though.
Quote
#6
Thanks for sharing metulburr.
Quote
#7
(Jul-19-2019, 03:55 PM)Thisisaline Wrote: I may not even use any programs that cause conflict and I'd just be overcomplicating things with venv for nothing.
Yes you should just try,pip can also uninstall.
Virtual environment is build into Python newer version,so it easy to try that first.
It work for me if i do a quick test,don't find GPU as i now run Virtual-box.
# Make environment 
tom@tom-VirtualBox:~/Documents$ python -m venv watt_env

# Cd in
tom@tom-VirtualBox:~/Documents$ cd watt_env/

# Activate 
tom@tom-VirtualBox:~/Documents/watt_env$ source bin/activate

# Test pip,it point to this folder as it should
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env$ pip -V
pip 19.0.3 from /home/tom/Documents/watt_env/lib/python3.7/site-packages/pip (python 3.7)

# Clone Repo
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env$ git clone https://github.com/BoukeHaarsma23/WattmanGTK.git
Cloning into 'WattmanGTK'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 753 (delta 0), reused 1 (delta 0), pack-reused 747
Receiving objects: 100% (753/753), 578.10 KiB | 1.14 MiB/s, done.
Resolving deltas: 100% (487/487), done.
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env$ cd WattmanGTK/
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env/WattmanGTK$ ls
LICENSE  README.md  run.py  setup.py  WattmanGTK

# Test Python
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env/WattmanGTK$ python -V
Python 3.7.3

# Run install
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env/WattmanGTK$ python setup.py install
running install ....
A couple of error,need to install this.
sudo apt-get install libcairo2-dev
sudo apt install libgirepository1.0-de
Run install again.
(watt_env) tom@tom-VirtualBox:~/Documents/watt_env/WattmanGTK$ python setup.py install
.....
Using /home/tom/Documents/watt_env/lib/python3.7/site-packages
Finished processing dependencies for WattmanGTK==0.0.1
Quote:Installing different versions in root (sudo apt) and in a non-root directory (pip -user) both provide global access and does not avoid conflicts. Is this correct?
If using pyenv Simple Python Version Management you safer from start,as it never mess with system install of Python.
It dos install Python version wanted(eg 3.7) and make it a system wide installation.
If all goes wrong just go back to local system pyenv local system.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  error using geoGen package from GITHUB hknarahari 4 66 9 hours ago
Last Post: buran
  using self-developed modules wlp 13 445 Aug-31-2019, 05:19 PM
Last Post: snippsat
  Importing Custom Modules in Python 3 Flexico 1 124 Aug-24-2019, 08:11 PM
Last Post: snippsat
  Installed Python3.7 from package, trying to run pip3.7 does not work JBristow1729 4 437 Aug-11-2019, 08:24 AM
Last Post: michaellossagk
  Best method: Python script called from another app, package as complete executable ironfelix717 2 153 Jul-24-2019, 07:39 AM
Last Post: DeaD_EyE
  python -m venv VS virtualenv kazi380 4 211 Jul-17-2019, 08:51 PM
Last Post: Larz60+
  I need help! How to package python code with other component into an exe file?? Wendy 4 232 Jul-15-2019, 01:29 PM
Last Post: snippsat
  Trouble importing modules on a new python version snackman_barry 2 181 Jul-12-2019, 11:15 AM
Last Post: snackman_barry
  installation directory of modules in python3.7 srm 2 222 Jul-11-2019, 01:06 PM
Last Post: joe_momma
  IndentationError on installed package evvvonder 3 444 Jun-29-2019, 10:30 PM
Last Post: Gribouillis

Forum Jump:


Users browsing this thread: 1 Guest(s)