Python Forum
preparing the installation of a Python-development environment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
preparing the installation of a Python-development environment
#1
dear Pythonists - dear experts - hello to the community,

first of all - i am a big big Python Fan.  
 
i am currently preparing my Asus Notebook for the installation of a Python-development environment. 
the prelimininary things i do are the following tests and here is what i have encountered. 

martin@MartinsMX-Rechner:~
$ python --version
Python 2.7.13
martin@MartinsMX-Rechner:~
$ uname -a
Linux MartinsMX-Rechner 4.19.0-5-amd64 #1 SMP Debian 4.19.37-2~mx17+1 (2019-05-15) x86_64 GNU/Linux
martin@MartinsMX-Rechner:~
$ 
well - i guess that i have to 

- renew the python version
- have a closer look at the MX-version ( - actual version is 19.1

then i should do the following:  

to setup pipenv to run and work with Python.

cf. python-guide.org/dev/virtualenvs/
Quote:Make sure you’ve got Python & pip
Before you go any further, make sure you have Python and that it’s available from your command line. You can check this by simply running:

$ python --version
You should get some output like 3.6.2. If you do not have Python, please install the latest 3.x version from python.org or
 refer to the Installing Python section of this guide.


the question is: How do I setup pipenv to use Python 3.6 when my system does not have python 3.6?

$ pipenv --python 2.7.1.3
Warning: python 2.7.1.3 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python
i guess - that i either sensu python-guide.org/dev/virtualenvs/ can work on the issues: 
- either i can manually write the version i need in the according Pipfile:

[requires]
python_version = "2.7.1.3"
Or i can install it on my system. But I guess we will need the version to be installed if we plan to actually run pipenv install.therefore i think that i should go ahead and use pyenv sensu: https://github.com/pyenv/pyenv.
i think that i have to follow the installation instructions, then afterwards installing Python 2.7.1.3. is just a matter of

 
pyenv install 2.7.1.3
Then i can set the order of preference with

pyenv global system 2.7.1.3
Besides, if pyenv is available, pipenv will automatically use it to install the required version. From pipenv README: Automatically install required Pythons, if pyenv is available.
 
Quote:This does a user installation to prevent breaking any system-wide packages. If pipenv isn’t available in the shell after installation, you’ll need to add the user base’s binary directory to your PATH.
On Linux and macOS you can find the user base binary directory by running python -m site --user-base and adding bin to the end. For example, this will typically
 print ~/.local (with ~ expanded
to the absolute path to your home directory) so you’ll need to add
~/.local/bin to your PATH. You can set your PATH permanently by modifying ~/.profile.
by the way: On Windows you can find the user base binary directory by running py -m site --user-site and replacing site-packages with Scripts.

For example, this could return C:\Users\Username\AppData\Roaming\Python36\site-packages so you would need to set your PATH to include C:\Users\Username\AppData\Roaming\Python36\Scripts. You can set your user PATH permanently in the Control Panel. You may need to log out for the PATH changes to take effect.

by the way: Well - i am on MX-Linux and i want to set up the environment on a linux-machine.


what do you say...?
Look forward to hear from you
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply
#2
see the installation tutorial for Linux here: https://python-forum.io/Thread-pyenv-Sim...Management
Reply
#3
dear Larz60+

many thanks for the quick reply - glad to hear from you.

(Mar-16-2020, 10:18 AM)Larz60+ Wrote: see the installation tutorial for Linux here: https://python-forum.io/Thread-pyenv-Sim...Management

i will have a closer look at the link and will do as advices.

have a great day Smile
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply
#4
hello dear Larz60+ - hello dear all,


first of all: many many thanks for the reply and your support. I am really very very happy to be part of this great community, It is such a great expecrience to be here - in this community of idea-exchange and knowledge-sharing.

to explain the situation here. i am in a new head start into python. I am a long term-linux-user (more than 15 years now)
currently i am on Linux MX 19.1 which is a Debian-based type of Linux. i want to set up a Python development environment:

i have several options: we can use Flatpack, since it is integrated into MXPI and it makes easier. some of my friends not use this (Fedora) packaging system, i can install codium as sugested on their web page: it is supposed to worked and we re keep getting updates if we install codium.

Here are the steps we can use: (Codium is the same as Code, just removed Microsoft 'telemetry')
VSCodium: https://github.com/VSCodium/vscodium/releases

# Add the GPG key of the repository:
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | sudo apt-key add -
# Add the repository:

Quote:echo 'deb https://gitlab.com/paulcarroty/vscodium-...epos/debs/ vscodium main' | sudo tee --append /etc/apt/sources.list.d/vscodium.list

# Update then install vscodium:

sudo apt update && sudo apt install codium
Anaconda: Btw, there is another option - Anaconda. If we install Anaconda, huge scientific package, many research labs use it,
it comes with VS Code (well during installation we need to confirm that we want VS Code also installed) and then VSCode becomes integrated with it. Plus we furthermore get another IDE, simpler Spyder, plus Jypiter Notebook which I really like for certain things. We can check out Anaconda also. Although it is damned huge, some 12GB and after we start creating virtual environments in it, it will get even damned-bigger. Ah, yes, it is perfect for managing virtual environments, we can create them with mouse click, choose what version of python to use with it, which packages... all with mouse if we prefer GUI. Lots of choices...

Well we probalby can also discuss ATOM too and Pycharm : alltogehter - lots and lots of choices. Which one to take?

update:

note: i currently work on two systems - on a MX-Linux and a Win10 machine:

and now i have to tell you i have PyCharm and ATOM on my Win10 machine:

i just updated PyCharm -

Question: can ATOM work with the Python 3.7 which PYCharm notes in the console. in other words - is Atom able to work
Quote::\Users\Kasper\PycharmProjects\untitled1\venv\Scri pts\python.exe "C:\Program Files\JetBrains\PyCharm Edu 2019.2\helpers\pydev\pydevconsole.py" --mode=client --port=50214
PyDev console: starting.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32

the question is: Question: can ATOM work with the Python 3.7 which PYCharm notes in the console. in other words - is Atom able to work


and how to test pip on the machine - is it included in Python 3.7!?

cf: https://matthewhorne.me/how-to-install-p...indows-10/

I
Quote:f the setup ran successfully, you should see a message “Setup was successful message.” Close and continue with the next steps.

Installing and Testing PIP: PIP is a package management system for Python, so you will want to install this handy tool to make your life simpler.

To install PIP first head over to “Get PIP,” you will see something like this:


C:\Users\Kasper>pip -V
pip 10.0.1 from c:\program files\python37\lib\site-packages\pip (python 3.7)
i am happy - i have pip installed ...


by the way: i have some errors while trying to install bs4

Installing collected packages: soupsieve, beautifulsoup4
Could not install packages due to an EnvironmentError: [WinError 5] Zugriff verweigert: 'c:\\program files\\python37\\Lib\\site-packages\\soupsieve'
Consider using the `--user` option or check the permissions.

You are using pip version 10.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\Kasper>
okay - i try not to mess up with this question regarding the windows-10 machine here in the office.
as mentioned above i have also a linux box (with MX-Linux Version 19.1 ) on this machine i will install VsCode and perhaps a second system (ATOM or PyCharm) too.


all in all - i want to work with python at the beginning of the next week... (i also have some interesting things i work on (see the idea exchange with snippset in the BS-Forum for scrapers and things like that ;)

above of all: many many thanks for the reply and your support. I am really very very happy to be part of this great community, It is such a great expecrience to be here - in this community of idea-exchange and knowledge-sharing.

i work on all the installation - things and keep you informed and posted.. here.

have a great day

Wink Smile
apollo
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply
#5
I see you test out a lot of stuff,some general tips.
(Mar-18-2020, 12:19 PM)apollo Wrote: okay - i try not to mess up with this question regarding the windows-10 machine here in the office.
So should upgrade pip,and the error you get could be because of permissions you on this user in office.
So if can run cmd as administrator,then upgrade pip and test install again.
Also the --user option for not need admin level to install.
# upgrade 
python -m pip install --user --upgrade pip

# Test that is 20.0.2,here is mine test
C:\>pip -V
pip 20.0.2 from c:\python37\lib\site-packages\pip (python 3.7)

# Install with --user option 
pip install --user <package_name>
(Mar-18-2020, 12:19 PM)apollo Wrote: Anaconda. If we install Anaconda, huge scientific package, many research labs use it,
For Anaconda there is also a Miniconda version.
Can also look into cloud version as both Google(Colaboratory) and Microsoft(Azure Notebooks) has these free version in cloud.
As a teaching tool these can save a lot headache,as all student have a full environment up running is seconds.
Then can you as a teacher take OS installation and other stuff gradually.

Local now i only run JupyterLab for Notebooks.
JupyterLab Wrote:JupyterLab is the next-generation web-based user interface for Project Jupyter.

I also have some tutorial about basic installation here you can look at.
Python 3.8 (3.6-3.7) and pip installation under Windows
Anaconda and other ways to run Python
Python environment Windows
VS Code from start
pyenv Simple Python Version Management
Reply
#6
Thumbs Up 
hello dear snippsat hello dear Larz60+ Wink

first of all - many thanks for the reply and for all your great ideas that you share.
btw: i allready have answered you on the other thread in the other sub-forum: https://python-forum.io/Thread-use-Xpath...#pid107636


I am currently working on the installation of Python on both machines.

....on:
- a win-10 box and on
- a linux-notebook (that runs MX-Linux)


the next steps here: within the next few days i will finsh the setup of the new python installation and the setup of ide / editors /(vscode, pycharm) then i will work on the code examples and next steps of the parser/(scraper) you have gave great steps to overcome the hurdle.

i am going to read thoroughly to your tipps and linked pages. It is a great and very very encouraging experience to be here

Quote:Python 3.8 (3.6-3.7) and pip installation under Windows
Anaconda and other ways to run Python
Python environment Windows
VS Code from start
pyenv Simple Python Version Management
... many thanks for these hints!!

have a great day.

regards
Apollo Wink
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply
#7
hello dear Larz+60, hello dear Snippsat,

i hopy you are doing well and all goes okay at your site. Within this week i have some time to work on the setting up of Python

- on my notebook (a Lenovo G780) that runs MX-Linux Version 19.1 with python 3.7xy and
- a Workstation (at the office) wich runs WIN 10 - where i have installed, PyCharm, ATOM and VSCode


here i want to talk about the findings on the Notebook with MX-Linux Version 19.1 - on which mainly i have installed ATOM - with some modules.

that said: At the moment i am working on the setup of the Python development on the MX-Linux-System -
I think it is very useful to collect all the findings in this single thread - with this procedure it can avoid to open several threads...

the situation. i am on the newest version of MX - which is 19.1: so far so good: the version MX-linux version 19.1 and i have installed python 3.7.xy


note: i have also pip installed -

root@mx:/home/martin# pip check
No broken requirements found.
to do this i have had several options:

a.
$ sudo apt-get install python3-pip
or
b.
$ sudo apt-get install python3-pandas
# OR
c.
$ pip3 install pandas	# your choice
so far so good - so... well i need to have the python csv-package. i tried out many comands

sudo apt-get install python-pip 
sudo apt-get install python3-pandas
sudo apt-get install python3-csv
sudo apt-get install python-csv
pip install python-csv
and furthermore

python -m pip install csv
i used the install-manual https://docs.python.org/3/installing/index.html

but see what i get

Collecting python-csv
Downloading https://files.pythonhosted.org/packages/a5/dc/7d044beccf6d10748ff5ad005441897e84265dea9aea9b39885758cc47fc/python-csv-0.0.11.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named setuptools


----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-DachfY/python-csv/
root@mx:/home/martin# ^C
root@mx:/home/martin#

question: can you give me a hint..!?

well at the moment i am a bit clueless.

update: i did some further research: now i have found out the following: ... to do the csv-package installation


a. for the Python 2 i can do the following:

apt-get install python-setuptools python-dev gcc g++
pip install wheel
and supsequnently:

pip install python-csv
for the Python 3 i have to do the following:


apt-get install python3-setuptools python3-dev gcc g++
pip3 install csv
now i will run these commands and hope i can go ahead.


Above all - i guess that it is pretty important to have set up the pip and some other preliminaries that help me to extend the python-environment if needed.


dear Larz60+ and dear Snippsat - plz stay healthy - all the best to you
have a great day.-

regards Apollo, Wink


ps - on a little sitenote: i am currently working on the project that is described here:
https://python-forum.io/Thread-use-Xpath...ip-setting
dear Snippsat - you gave me great mini-lessons and a examples and a starting point - for us to make the next steps...
i work on these and allready have had some success. This is all thanks to you - You are heros. Wink Wink i will come back to the above mentioned thread within the next week and will show you what i have gained... have a great day.
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply
#8
You could also build a Docker image containing Python and the libraries you're likely to need (there are already official Docker images for Python) that you can use anywhere (anywhere you have Docker installed). I've taken this approach with Clojure, for example, so that I can have the same set up on both my work Mac and my personal Linux machine, without much hassle.
Reply
#9
hello dear snippsat hello dear Larz60+ good day dear ndc85430, Smile

first of all - many many thanks for all your hints and tipps - and for the idea-sharing.

dear ndc85430: guess that it surely is worth to look into docker (and perhaps into Anaconda too - since i guess that i might get rid of the hell of dependencies... note: i am installing all that stuff on both on ... a. on win 10 and b. on linux ?


i have read some and have seen a whole bunch of tutorials on the setup virtual environment for Python

- in VS Code - best practices for using Virtualenv
- and besides for ATOM ...

i am very very glad that you have posted and give me some important hints:


Quote:it semms like the package which i installed and the project's environment i am currently using is different.
the package which i have installed was in the global environment: " c:\program files\python37\lib\site-packages ", and well it seems like i looks like using the environment different(maybe the environment related to the project): This said i try ton identify this by look the right left coner shows which environment i am currently using now.


So i guess that i have to using virtualenv to isolate my projects and then i store pip dependencies in requirements.txt.
As we develop, we install, remove and upgrade packages, the list of dependencies in your project differs from requirements.txt

but how can i do it right - how to setup venv the right way -
a. on win 10 and
b. on linux ?

i have setup a python-development-environment on a Windows 10 machine and on a MX-Linux-machine.
i guess that i set up the machine /ATOM badly - any and all help greatly appreciated.


note: the setup of Python with global mode is weird so weird.

regarding the set up and usage of virtual environment in VSCode

I recently have read an article on using Virtual Environments for Python projects.
https://towardsdatascience.com/python-vi...0c603fe601

and this one Comparing Python Virtual Environment tools
https://towardsdatascience.com/comparing...6543643a44

guess, that have to take care how i setup python on my linux-machine.

Comparing installed pip packages with requirements.txt :: So if we are using virtualenv to isolate our projects and then subsequently we store pip dependencies in requirements.txt. As we develop, we install, remove and upgrade packages, the list of dependencies in your project differs from the so called requirements.txt

Currently Installed Packages: To list what are the packages that are actually installed, we can run

$ pip freeze
Compare Differences: A simple comparison of requirements.txt and pip freeze will fail because the packages are in different order.
sort both of the output then compare them with pip

to sume up: some of the best Practices are the following:

- Always make sure requirements.txt reflects the actual dependencies
- Pin package dependencies - use the exact version
- Preferably track only the top level dependencies in your requirements.txt
- Update dependencies periodically - year but how
- Consider using pip-compile and pip-sync to manage your dependencies. Use pur to automatically update your top level dependencies in requirements.txt


I am starting to work on VS-Code using venv: In my project folder I guess that i have to create venv folder.

python -m venv venv /path/to/new/virtual/environment
but when i run in VS Code the command select python interpreter my venv folder is not shown.

to make sure that i do all okay i try the following steps
to make my virtual interpreter in VS Code visible? i

1. just go to File > preferences > Settings - afterwards i

2. click on Workspace settings.

3. Under Files: Association, we will find Edit in settings.json , Well i click on that.


4. Update "python.pythonPath": "my_venv_path/bin/python" under workspace settings.

(For Windows): Update "python.pythonPath": "my_venv_path/Scripts/python.exe" under workspace settings. And subsequently

5. Restart VSCode incase if it still doesn't show the venv.


another option to show virtual environments in vs code:

go to the parent folder in which venv is there through command prompt.
Type code . and Enter. [Working on both windows and linux for me.]

That should also show the virtual environments present in that folder.

In one workspace folder named Python need to adde all my other projects.

to spell it out clearly:

- I would have to have only one venv for the whole workspace folder Python.
- i add each subfolder in Python folder as a workspace project like Project1, Project2, Project3, Project4, Project5, Project6 etc.

In that Project folder I created venv environment and edited settings.json for workspace with this "python.venvPath": "venv" .
Now, for every new project I will create new workspace and inside that folder goes venv folder which will be automatically recognized.



+------------------------+
|                        |
|                        |
|     python-workspace   |
|     ....-folder        |
|                        |
+----------+-------------+
           |
           |
           |              +----------------------+
           |              |                      |
           +--------------+     Project1         |
           |              |                      |
           |              +----------------------+
           |
           |              +----------------------+
           |              |                      |
           +--------------+     Project2         |
           |              |                      |
           |              +----------------------+
           |
           |              +----------------------+
           |              |                      |
           +--------------+     Project3         |
           |              |                      |
           |              +----------------------+
           |
           |              +----------------------+
           |              |                      |
           +--------------+     Project4         |
           |              |                      |
           |              +----------------------+
           |
           |              +----------------------+
           |              |                      |
           +--------------+    Project5          |
           |              |                      |
           |              +----------------------+
           |
           |              +----------------------+
           |              |                      |
           +--------------+   Project6           |
                          |                      |
                          +----------------------+
how do you like this idea!?



some additional ideas:

Attention: I was trying to make my project directory and the virtual environment one and the same - which isn't correct.

I have a \Code\Python directory where I store all my Python projects.

My
Python 3 installation is on my Path.
If I want to create a new Python project (Project1) with its own virtual environment, then I do this:

python -m venv Code\Python\Project1\venv
Then, simply opening the folder (Project1) in Visual Studio Code ensures that the correct virtual environment is used.


how do you like this idea!? Smile

yours Apollo - allways going the hard way Big Grin
learing Python the hard way Shy
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python installation for old MacOS Yonix 1 488 Sep-21-2023, 03:32 PM
Last Post: menator01
  Installing python packages in a virtual environment Led_Zeppelin 1 758 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Installation of packages to newest Python version from previous one Andrzej_Andrzej 3 829 Jul-15-2023, 11:32 AM
Last Post: snippsat
  Development Environment Problems standenman 1 520 Jun-13-2023, 10:45 PM
Last Post: Larz60+
  Understanding venv; How do I ensure my python script uses the environment every time? Calab 1 2,257 May-10-2023, 02:13 PM
Last Post: Calab
  Python development environment standenman 3 1,608 May-04-2023, 07:24 PM
Last Post: snippsat
  How to see the date of installation of python modules. newbieAuggie2019 4 1,572 Mar-31-2023, 12:40 PM
Last Post: newbieAuggie2019
  Getting "SSL client not supported by this Python installation" error prabirsarkar 0 950 Mar-13-2023, 05:01 PM
Last Post: prabirsarkar
  Python Scripting Environment jpotter0 1 1,709 Nov-19-2022, 03:07 PM
Last Post: snippsat
  python installation/running inside singularity container erdemath 2 1,769 Sep-21-2022, 08:13 AM
Last Post: erdemath

Forum Jump:

User Panel Messages

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