![]() |
preparing the installation of a Python-development environment - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: preparing the installation of a Python-development environment (/thread-25028.html) |
preparing the installation of a Python-development environment - apollo - Mar-16-2020 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 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/pythoni 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.3Then i can set the order of preference with pyenv global system 2.7.1.3Besides, 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. 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 RE: preparing the installation of a Python-development environment - Larz60+ - Mar-16-2020 see the installation tutorial for Linux here: https://python-forum.io/Thread-pyenv-Simple-Python-Version-Management RE: preparing the installation of a Python-development environment - apollo - Mar-16-2020 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-Simple-Python-Version-Management i will have a closer look at the link and will do as advices. have a great day ![]() RE: preparing the installation of a Python-development environment - apollo - Mar-18-2020 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-deb-rpm-repo/raw/repos/debs/ vscodium main' | sudo tee --append /etc/apt/sources.list.d/vscodium.list # Update then install vscodium: sudo apt update && sudo apt install codiumAnaconda: 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 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-python-and-pip-on-windows-10/ I Quote:f the setup ran successfully, you should see a message “Setup was successful message.” Close and continue with the next steps. 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 ![]() ![]() apollo RE: preparing the installation of a Python-development environment - snippsat - Mar-18-2020 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 RE: preparing the installation of a Python-development environment - apollo - Mar-18-2020 hello dear snippsat hello dear Larz60+ ![]() 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-in-Python-libxml2-for-a-page-to-page-skip-setting?pid=107636#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... many thanks for these hints!! have a great day. regards Apollo ![]() RE: preparing the installation of a Python-development environment - apollo - Mar-24-2020 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-pipor b. $ sudo apt-get install python3-pandas# OR c. $ pip3 install pandas # your choiceso 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-csvand furthermore python -m pip install csvi 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 wheeland supsequnently: pip install python-csvfor the Python 3 i have to do the following: apt-get install python3-setuptools python3-dev gcc g++ pip3 install csvnow 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, ![]() ps - on a little sitenote: i am currently working on the project that is described here: https://python-forum.io/Thread-use-Xpath-in-Python-libxml2-for-a-page-to-page-skip-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. ![]() ![]() RE: preparing the installation of a Python-development environment - ndc85430 - Mar-24-2020 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. RE: preparing the installation of a Python-development environment - apollo - Apr-02-2020 hello dear snippsat hello dear Larz60+ good day dear ndc85430, ![]() 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. 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-virtual-environments-made-easy-fe0c603fe601 and this one Comparing Python Virtual Environment tools https://towardsdatascience.com/comparing-python-virtual-environment-tools-9a6543643a44 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 freezeCompare 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/environmentbut 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\venvThen, simply opening the folder (Project1) in Visual Studio Code ensures that the correct virtual environment is used. how do you like this idea!? ![]() yours Apollo - allways going the hard way ![]() learing Python the hard way ![]() |