LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-28-2018, 11:27 AM   #1
vysero
Member
 
Registered: May 2018
Posts: 137

Rep: Reputation: Disabled
Attempting to understand how/where Ubuntu stores files


If I open a terminal and type: python3 it will run python3.5.2. How can I find where exactly in my computer this interpreter is located?

The reason I ask is I think I may have multiple versions of the same interpreter on my computer because my IDE PyCharm doesn't seem to have access to modules that I download via: apt-get install or pip.
 
Old 06-28-2018, 11:32 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Use the 'which' command.

Once it tells you where it is running from, do an 'ls -l' of the file in the directory to determine if it is a symbolic link or the actual binary.
 
Old 06-28-2018, 11:33 AM   #3
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
Code:
whereis python3
I wouldn't start fiddling directly with Python executables though, since they are essential to a fair bit of the workings of the system.

What you should be aware of is that your system will probably have both Python 2 and Python 3 installed and will need both of these (since different software on your system could use either). You may find that you are installing modules in Python 2 and then trying to access them in Python 3. Python3, for example, uses pip3.

It would be useful if you were to give us one example of a module that you can't access so that we can see why that isn't working.
 
Old 06-28-2018, 11:33 AM   #4
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by vysero View Post
If I open a terminal and type: python3 it will run python3.5.2. How can I find where exactly in my computer this interpreter is located?

The reason I ask is I think I may have multiple versions of the same interpreter on my computer because my IDE PyCharm doesn't seem to have access to modules that I download via: apt-get install or pip.
The "find" and "locate" and "whereis" commands spring to mind straight away.

Code:
man find
man locate
man whereis
 
Old 06-28-2018, 11:36 AM   #5
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Code:
which python3
gives me /usr/bin/python3
Code:
ls -l /usr/bin/python3
gives me
Quote:
lrwxrwxrwx 1 root root 9 Oct 3 2017 /usr/bin/python3 -> python3.4
But...
Code:
python3 --version
gives me
Quote:
Python 3.4.2
 
Old 06-28-2018, 11:44 AM   #6
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hydrurga View Post
Code:
whereis python3
I wouldn't start fiddling directly with Python executables though, since they are essential to a fair bit of the workings of the system.

What you should be aware of is that your system will probably have both Python 2 and Python 3 installed and will need both of these (since different software on your system could use either). You may find that you are installing modules in Python 2 and then trying to access them in Python 3. Python3, for example, uses pip3.

It would be useful if you were to give us one example of a module that you can't access so that we can see why that isn't working.
I did a sudo apt-get install python-qt4. I can use the module (at least I believe it is called a module) in a terminal with python 3.5.2. However, when I load PyCharm and I select the Base interpreter for some .py script to be python3.5 from: /usr/bin/python3.5 and I select the Inherit global site-packages check box it doesn't show pyqt4 anywhere in the list of packages that it populates.

How is it that from a terminal using python3.5 I have access to the pyqt4 module but not from within PyCharm is what I am asking myself. I figured, maybe I have two different versions of the python3.5 interpreter downloaded on my computer and 2 different locations where those intersperses are storing their modules?
 
Old 06-28-2018, 11:54 AM   #7
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
A quick note: using which python3.5 tells me that the interpreter is located @ /usr/bin/python3.5 which is the same location that PyCharm says it has found the python3.5 interpreter, now I am very confused.
 
Old 06-28-2018, 12:05 PM   #8
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
Let's see what you have installed:

Code:
dpkg -l "*python3.*" | grep ^ii
 
Old 06-28-2018, 12:21 PM   #9
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hydrurga View Post
Let's see what you have installed:

Code:
dpkg -l "*python3.*" | grep ^ii
ii libpython3.5:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Shared Python runtime library (version 3.5)
ii libpython3.5-dev:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Header files and a static library for Python (v3.5)
ii libpython3.5-minimal:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Minimal subset of the Python language (version 3.5)
ii libpython3.5-stdlib:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Interactive high-level object-oriented language (standard library, version 3.5)
ii python3.5 3.5.2-2ubuntu0~16.04.4 amd64 Interactive high-level object-oriented language (version 3.5)
ii python3.5-dev 3.5.2-2ubuntu0~16.04.4 amd64 Header files and a static library for Python (v3.5)
ii python3.5-minimal 3.5.2-2ubuntu0~16.04.4 amd64 Minimal subset of the Python language (version 3.5)

Another quick update. I managed to get PyCharm run from the interpreter located at /usr/bin/python3.5 and now it is not throwing me errors when I pull from the pyqt4 module with this script for instance:

Code:
import sys
from PyQt4 import QtGui

app = QtGui.QApplication(sys.argv)

window = QtGui.QWidget()

window.setGeometry(0,0,500,300)

window.setWindowTitle('PyQT Window')

window.show()
However, running the application does not open up a window like it would if I was running the same script in a terminal. Also, now when I attempt to install packages from within PyCharm via the project interpreter page it asks me for the sysadmin password. I guess I am left wondering:

a) What interpreter I was using before such that I did not have access to all the packages I would normally have access to via a terminal but I did not have to enter my sysadmin password

b) Why is the PyCharm IDE unable to run pyqt4 in the same way that a terminal can and

c) How can I fix this mess I have created
 
Old 06-28-2018, 12:45 PM   #10
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
$ which python3

You can also use apt-file.

$ apt-file find bin/python

Which will tell you where it's located, and what package(s) contains that file.
 
Old 06-28-2018, 12:51 PM   #11
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Apparently, in PyCharm there is a Virtualenv Enviorment where you can select the python3.5 interpreter; however, you will not be able to use the same packages it uses. Instead, if you select System Interpreter (rather than Virtualenv) then you can use the packages you already have installed but you will need to provide admin permissions to install new packages. That being said it doesn't seem to matter because I can't do what I want to do which is use pyqt4 with either route.

With the Virtulenv Enviorment route it gives me an error when attempting to install the pyqt4 package and with the System Interpreter route it says I have pyqt4 but it does not function like I would expect. I have looked online and other people have had similar problems; however, their solutions do not work for me. I have attempted going to the source and raised a query at: https://intellij-support.jetbrains.com but in my experiance those query's never get answered.

Any ideas in the meantime?
 
Old 06-28-2018, 03:51 PM   #12
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
Quote:
Originally Posted by vysero View Post
ii libpython3.5:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Shared Python runtime library (version 3.5)
ii libpython3.5-dev:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Header files and a static library for Python (v3.5)
ii libpython3.5-minimal:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Minimal subset of the Python language (version 3.5)
ii libpython3.5-stdlib:amd64 3.5.2-2ubuntu0~16.04.4 amd64 Interactive high-level object-oriented language (standard library, version 3.5)
ii python3.5 3.5.2-2ubuntu0~16.04.4 amd64 Interactive high-level object-oriented language (version 3.5)
ii python3.5-dev 3.5.2-2ubuntu0~16.04.4 amd64 Header files and a static library for Python (v3.5)
ii python3.5-minimal 3.5.2-2ubuntu0~16.04.4 amd64 Minimal subset of the Python language (version 3.5)
Only one version of Python 3 installed then (3.5.2). To me the evidence points towards this being a specific PyCharm issue.
 
Old 06-28-2018, 06:28 PM   #13
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
If I try
Code:
ls -l /usr/bin/python*
then I get...
Code:
lrwxrwxrwx 1 root root       9 Oct  3  2017 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root       9 Oct  3  2017 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3781768 Jun 29  2016 /usr/bin/python2.7
lrwxrwxrwx 1 root root       9 Oct  3  2017 /usr/bin/python3 -> python3.4
-rwxr-xr-x 1 root root 4476488 Oct  8  2014 /usr/bin/python3.4
-rwxr-xr-x 1 root root 4476488 Oct  8  2014 /usr/bin/python3.4m
lrwxrwxrwx 1 root root      10 Oct  3  2017 /usr/bin/python3m -> python3.4m
So the symbolic links give python = python2 = python2.7 and python3 = python3.4 and additionally python3m = python3.4m (both versions exist and are identical)

Obviously someone fouled up badly on the whole version numbering thing.
 
Old 06-29-2018, 02:04 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,879

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
Quote:
Originally Posted by vysero View Post
Apparently, in PyCharm there is a Virtualenv Enviorment where you can select the python3.5 interpreter; however, you will not be able to use the same packages it uses. Instead, if you select System Interpreter (rather than Virtualenv) then you can use the packages you already have installed but you will need to provide admin permissions to install new packages. That being said it doesn't seem to matter because I can't do what I want to do which is use pyqt4 with either route.

With the Virtulenv Enviorment route it gives me an error when attempting to install the pyqt4 package and with the System Interpreter route it says I have pyqt4 but it does not function like I would expect. I have looked online and other people have had similar problems; however, their solutions do not work for me. I have attempted going to the source and raised a query at: https://intellij-support.jetbrains.com but in my experiance those query's never get answered.

Any ideas in the meantime?
This is a post which explains (at least for me) that you still did not tell us your real problem, what do you want to achieve and other details. What you wrote here contains no usable information. I would suggest you to start over again and speak about your issue. Where did you stuck?

(by the way virtualenv is virtually a different env, that's why it differs....)
http://catb.org/~esr/faqs/smart-ques...html#beprecise
 
  


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
Trying to change the location where mysql stores its database files Regnets1 Linux - Software 2 05-25-2018 01:32 PM
Keyboard inoperative when booting to Ubuntu CD or attempting to install Ubuntu jdruin Linux - Hardware 5 12-26-2008 06:32 PM
LXer: Best Buy stores to sell boxed version of Ubuntu Linux LXer Syndicated Linux News 0 07-10-2008 06:31 AM
where ubuntu stores bash configuration? santana Ubuntu 2 04-25-2007 02:31 PM
attempting to understand ports bshearer *BSD 4 04-24-2005 08:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:43 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