Python Forum

Full Version: Why so complicated?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Jan-28-2018, 01:37 AM)wavic Wrote: [ -> ]Can you tell which is the default Python version? If you run python2 or python3 as it is here is it able to import the modules.

I'm not sure whether I've misinterpreted your question, but I'm running python3.6.4 :)

(Jan-28-2018, 01:11 AM)league55 Wrote: [ -> ]When I tried Fedora 27, I installed Python libraries only through dnf. If there was no repository package for a library, then it meant the Fedora developers hadn't integrated it with the current release of their distro.

The only time I used pip was within a virtual environment (as explained above). Both virtualenv and venv are available as Fedora packages installable through dnf. I don't know whether virtualenvwrapper is because I didn't know about it.

Very interesting! Do you simply type in "dnf install (--user) <module>" in stead of "pip install (--user) <module>"?

(Jan-28-2018, 08:28 AM)league55 Wrote: [ -> ]
(Jan-28-2018, 05:37 AM)Gribouillis Wrote: [ -> ]I like KDE because it has a classical look and feel. I've been using it for years without problems, but it is only a personal choice.

Since the OP introduced this minor topic drift...

I've always found that KDE throws too many exceptions into its neat little exception popup boxes. Seriously, every time I've tried the KDE version of a Linux distro, I've gotten tons of those popup error messages. If the OP is already having problems with Fedora then recommending KDE Fedora might not be the thing to do (although, in fairness, you didn't say anything about KDE Fedora).
Just to be clear, I've had no issues with Fedora, the Python grief aside. I don't really understand how they can say that one has to be an absolute computer wizard in order to make it work. Quite on the contrary, actually, I found it somewhat intuitive from the beginning, even if I'm new to Linux as well :)

------

I reckon I'll try out the Kubuntu today, then proceed to read and test out the instructions provided in this thread. I will be back later on to let you all know how it turned out. Thank you once again, your help is much appreciated :)
(Jan-28-2018, 10:59 AM)vulpesVelox Wrote: [ -> ]Very interesting! Do you simply type in "dnf install (--user) <module>" in stead of "pip install (--user) <module>"?

Yes, but I always had to start with dnf search <module> to find the exact name of the package, because I was used to Debian-style package names, and Fedora's are different. The good thing is that dnf's search results are a LOT better than apt's.
For me typing --user or using package manager to install to Python is not okay.
pyenv always works as user,and there is no pip2 or pip3.
python and pip always point to what set as global version,and isn’t just limited to the CPython versions,
it will also install PyPy, Anaconda, Miniconda, Stackless, Jython, and Ironpython interpreters.
These can be set as global or can just use/test them in a shell session.

Example can start Anaconda/miniconda and Jupyter Notebook.
So can now eg have the power of 1,000+ packages that Anaconda has.
mint@mint ~ $ pyenv shell miniconda3-4.3.11
(miniconda3-4.3.11) mint@mint ~ $ pip -V
pip 9.0.1 from /home/mint/.pyenv/versions/miniconda3-4.3.11/lib/python3.6/site-packages (python 3.6)
(miniconda3-4.3.11) mint@mint ~ $ conda -V
conda 4.3.21
(miniconda3-4.3.11) mint@mint ~ $ python -V
Python 3.6.0 :: Continuum Analytics, Inc.
(miniconda3-4.3.11) mint@mint ~ $ jupyter notebook
Exit or start a new shell and it's back to what set as global version(the main version that's used daily).
mint@mint ~ $ python -V
Python 3.6.4
mint@mint ~ $ pip -V
pip 9.0.1 from /home/mint/.pyenv/versions/3.6.4/lib/python3.6/site-packages (python 3.6)
mint@mint ~ $ 

For virtual environment is now build into 3.6,trough venv.
But what i use most now is pipenv,it's really good.
It gives a lot better overview of dependencies.
Eg graph:
λ pipenv graph
beautifulsoup4==4.6.0
lxml==3.8.0
pip==9.0.1
requests==2.18.4
  - certifi [required: >=2017.4.17, installed: 2017.7.27.1]
  - chardet [required: <3.1.0,>=3.0.2, installed: 3.0.4]
  - idna [required: >=2.5,<2.7, installed: 2.6]
  - urllib3 [required: <1.23,>=1.21.1, installed: 1.22]
setuptools==36.4.0
wheel==0.30.0
See all version number and Requests has underlying dependencies certifi,chardet...ect.
I had to put in a little work today (I swear, if those people didn't pay me, I'd simply stay home >:@ ), but now I've managed to install Ubuntu, had a wee look at the structure of the O/S, and am currently going through Snippsat's guide. Which is very helpful for a beginner, I might add; thank you for the effort :)

Upon inserting sudo pip3 install virtualenv I receive:

Output:
The directory '/home/vulpes/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/vulpes/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
I have a hunch that it's somehow connected to what I was experiencing yesterday in terms of the errno 13, that kept popping up; there's something off with my permissions. Even if I'm running the O/S as admin.

Proceeding, after succesfully installing virtualenv, I get:

Output:
You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
I typed in sudo apt install python-pip, and then I received some white text:

Output:
The program 'pip' is currently not installed. You can install it by typing: sudo apt install python-pip
Moving along I get versions: 3.5.2 & 2.7.12

I skipped the hello.py part, and went on to seeing if I could fetch the request module, and once more I received:

Output:
The directory '/home/vulpes/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/vulpes/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
I'll stop here for now and simply read the guide, as I suspect that the permission problem will persist and - god forbid - disrupt something if I provoke it too much.
The last message doesn't mean that the packet is not installed. This is happening when you pip install using sudo.

For example:
$ sudo python3.5 -m pip install -U scapy-python3
Output:
The directory '/home/victor/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/victor/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already up-to-date: scapy-python3 in /usr/local/lib/python3.5/dist-packages
(Jan-28-2018, 09:21 PM)wavic Wrote: [ -> ]The last message doesn't mean that the packet is not installed. This is happening when you pip install using sudo.

For example:
$ sudo python3.5 -m pip install -U scapy-python3
Output:
The directory '/home/victor/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/victor/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already up-to-date: scapy-python3 in /usr/local/lib/python3.5/dist-packages

OK, well that's good to know. I suspected that it wasn't an error as such as errors tend to be red text.

Still, the problem (and corresponding confusion) seems to persist; moving along from where I left off:
I ran the pip list command and was a bit surprised to see modules that I haven't yet installed, e.g. Pillow (3.1.2) was listed.
I then typed in python3 followed by import Pillow, and the machine returns:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'Pillow'

Upon exiting python and typing either pip3 install Pillow or pip install Pillow and I'm presented with:
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages

Reading along, I skipped the "find-title.py" section as I'm well into how webscraping works.

Setting up a Virtual Environment; well I've had a look, and I think I get it, however I speculate whether it's really necessary at this point, as I rarely venture beyond the basic stuff, furthermore I'm not all too worried about what happens to the system. It takes me roughly 30 min. to reinstall the entire system, and my "talent" for creating redundant backups is quite up to par :)

pyenv install 3.6.1 gives me:
No command 'pyenv' found, did you mean:
Command 'p7env' from package 'libnss3-tools' (universe)
Command 'pyvenv' from package 'python3-venv' (universe)
pyenv: command not found

Setting up pyenv section:
Runs without incident untill git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv, where I'm met with the message pyenv: command not found once again.

-----------------------------------

I'm entertaining the notion that the entire process, I've just passed through, could be automated via script, but, as you've probably gathered by now, I don't know what I'm talking about Blush
(Jan-30-2018, 01:51 PM)vulpesVelox Wrote: [ -> ]I then typed in python3 followed by import Pillow, and the machine returns:
Read the doc,it's from PIL import Image.
Quote:pyenv install 3.6.1 gives me:
No command 'pyenv' found, did you mean:
Tutorial see Setting up pyenv.
This is for vulpesVelox:

1.Your question is very good.
2.Very few people who make YouTube videos know how to make them clear and easy to follow.
3.You may find what I've found, that the best way to learn Python is not to use YouTube videos, or even worse, python forums, but instead it's better to hire a private instructor.

Good luck!
(Jan-31-2018, 02:40 AM)nelsonkane Wrote: [ -> ]This is for vulpesVelox:

1.Your question is very good.
2.Very few people who make YouTube videos know how to make them clear and easy to follow.
3.You may find what I've found, that the best way to learn Python is not to use YouTube videos, or even worse, python forums, but instead it's better to hire a private instructor.

Good luck!

Thank you for posting.
It has become a bit daunting, I must admit. This is typical in a learning proces, I feel; you realize just how far down the rabbit hole goes, as you descend. I'm still putting up a fight, and I should mention that I am more or less adept in the 'self education'-department. The discipline is there, and I'm used to filtering.

I found a few youtube videos that had some quality aspect to them when I started out a couple of months ago. I'm not going to disagree with you at all; a lot of those videos are just a waste of time, as you may read a tutorial much, much faster, seeing as you get the opportunity to effectively weed out the "errrrr..."'s and the "uhmmmm..."'s
On the other hand that 15 hour long video, that I passed through over a fortnight helped me tremendously with the basics. I was passing through https://www.learnpython.org/ before that, but as a beginner it was too heavy, especially seeing as I'm not a native english speaker. It's effective, but probably not very pedagogical what with all the fancy words for very simple things.

I returned after the video and understood it better, and have since then passed through some other courses and I found a nice overview of the basics, that works well in terms of repetition.

Your advice is well received. I have been thinking about the very same thing; that it would be useful if I had a mentor. - I've just found that there is a tech-cafe close to where I live, so I'll be paying them a visit as soon as I'm back home (family affairs this week).

Again, thank you for posting :)

(Jan-30-2018, 06:52 PM)snippsat Wrote: [ -> ]
(Jan-30-2018, 01:51 PM)vulpesVelox Wrote: [ -> ]I then typed in python3 followed by import Pillow, and the machine returns:
Read the doc,it's from PIL import Image.
Quote:pyenv install 3.6.1 gives me:
No command 'pyenv' found, did you mean:
Tutorial see Setting up pyenv.
But... Isn't PIL (about to be) deprecated? I've read that I should go for Pillow instead in various forums, tutorials and whatnot..?

In terms of your cool tutorial, I've already gone over the pyenv section, as per post #16. - what am I missing?
Pages: 1 2