Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

pipenv or virtualenv - what is the best way to use on linux

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
say_hello
Posts: 36
Joined: 2019-10-13 09:58

pipenv or virtualenv - what is the best way to use on linux

#1 Post by say_hello »

Hello dear fellows,

pipenv or virtualenv - what is the best way to use on linux


I've been using virtualenv in the past. I want to create a virtual environment for a project I'm working on. I use MX-Linux so I usually enter these commands inside the directory of my project:

Code: Select all

$python3 -m venv venv

$. venv/bin/activate

(venv)$

Then my virtual environment is activated and I'm ready to install packages with pip. But I know that there's another dependency manager called pipenv. I don't use it at all because I'm not sure whether it's going to interfere with packages I already installed with virtualenv. I had that problem before when I installed packages with both sudo apt install and pip. However, I read online that pipenv is supposed to be the better way to handle packages. Is there any drawbacks to continue using virtualenv or should I just switch over completely to pipenv?

some of my friends want me to use pipenv.

they recommend it - since it is well known to help people who are intimidated by virtualenvs, but well it is not appropriate for all use cases. pipenv seems actually to rely on pip and virtualenv, so virtualenv is not going away.
There are also some common criticisms of pipenv.

What should i do - i do need your advice.


what do you reccomend!?

update:



finally managed to setup VSCodium on the MX-Linux (Version 19.1)

Code: Select all

Version: 1.43.2
Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
Date: 2020-03-24T21:03:16.125Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 4.19.0-6-amd64
guess that this is the actual Version!?! . again the machine: MX-19.1 with Python 3.7.xy installed
Note: at the moment VSCodium is not configured towards a python-development-system. These steps have not been made.
conclusio: on the mx-linux i now have VSCodium besides ATOM-Editor - i like ATOM it has a nice Github-Integration.

on a sidenote: on the Windows-machine (WIN-10) i have VS-Code Version: 1.43:

see on Win10 i have the following data:


Code: Select all

1 Version: 1.43.2 (user setup)
2 Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
3 Date: 2020-03-24T07:38:38.248Z
4 Electron: 7.1.11
5 Chrome: 78.0.3904.130
6 Node.js: 12.8.1
7 V8: 7.8.279.23-electron.0
8 OS: Windows_NT x64 10.0.18363

at the moment i struggle with the following message:

Code: Select all

 NodeJS not detected on this machine, which is required for Pymakr to work. See the Pymakr readme for dependancies.

well back to the Linux-machine with MX-Linux version 19.1 and with ATOM. on a freshly installed ATOM on MX-Linux: i have to setup a lot. for some test i run the code - taken from here: https://stackoverflow.com/questions/609 ... o-datafram

see what i have got back bs4_request_10 Link: https://pastebin.com/C3V8vryr

Code: Select all

Traceback (most recent call last):
  File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 25, in <module>
    Main(urls)
  File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 20, in Main
    df.to_csv("data.csv", index=False)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3020, in to_csv
    formatter.save()
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 172, in save
    self._save()
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 288, in _save
    self._save_chunk(start_i, end_i)
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 315, in _save_chunk
    self.cols, self.writer)
  File "pandas/_libs/writers.pyx", line 75, in pandas._libs.writers.write_csv_rows
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 39: ordinal not in range(128)
[Finished in 3.134s]


by the way:
see more errors: gathered with bs4 scripts form SO within the last 5 days - runned here:

bs4_request_1 Link: https://pastebin.com/sUmva6iJ
bs4_request_2 Link: https://pastebin.com/Tt3XaG4p
bs4_request_3 Link: https://pastebin.com/wf9VTvjs
bs4_request_4 Link: https://pastebin.com/1s6LVqni
bs4_request_6 Link: https://pastebin.com/tEsZxxEs
bs4_request_7 Link: https://pastebin.com/55q4ewrq
bs4_request_8 Link: https://pastebin.com/YNKAMUXH

bs4_request_10 Link: https://pastebin.com/C3V8vryr

i guess that i set up the machine /ATOM badly … - any and all help greatly appreciated. - regards Zero


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

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

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


dear experts on this great forum at Debianusers. i look forward to hear from you.

above all - stay healthy - and all the best to you both!!!

regards say hello

update:

above all - stay healthy - and all the best to you both!!!
regards


update: i am glad i have new insights - and it seems that i have some unicode-issues on my machine.. - i need to set the ATOM

i gathered more insights: note i run the following code on MX-Linux version 19.1 (where Python runs in Version 3.7.xy) with a fresh installation of ATOM -

cf: https://stackoverflow.com/questions/609 ... o-datafram



Code: Select all

    import requests
    from bs4 import BeautifulSoup
    import pandas as pd

    def Main(urls):
        with requests.Session() as req:
            allin = []
            for url in urls:
                r = req.get(url)
                soup = BeautifulSoup(r.content, 'html.parser')
                target = soup.find(
                    "dl", class_="c-description-list c-description-list--striped")
                names = [item.text for item in target.findAll("dt")]
                names.append("url")
                data = [item.get_text(strip=True) for item in target.findAll("dd")]
                data.append(url)
                allin.append(data)
            df = pd.DataFrame(allin, columns=names)
            df.to_csv("data.csv", index=False, encoding="utf-8")

urls = ['https://www2.daad.de/deutschland/studie ... tail/4722/',
'https://www2.daad.de/deutschland/studie ... tail/6318/']
Main(urls)


question - how to find out where the script stores the results - the csv-file.
can i set the paths in ATOM some how some way - are there some options to do this!?


btw: very interesting without the encoding = "utf-8" in the line df.to_csv("data.csv", index=False, encoding="utf-8") i have errors since ihave UnicodeEncodeError, seems that my system default encoding isn't utf-8, therefor,

guessing: i guess that i set up the machine /ATOM badly … - any and all help greatly appreciated. -


Code: Select all

    Traceback (most recent call last):
      File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 25, in <module>
        Main(urls)
      File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 20, in Main
        df.to_csv("data.csv", index=False)
      File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3020, in to_csv
        formatter.save()
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 172, in save
        self._save()
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 288, in _save
        self._save_chunk(start_i, end_i)
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 315, in _save_chunk
        self.cols, self.writer)
      File "pandas/_libs/writers.pyx", line 75, in pandas._libs.writers.write_csv_rows
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 39: ordinal not in range(128)
    [Finished in 3.134s]
with the correct encoding the script runs very well python - daad_studienangebote_url_liste.py:21

i get back this result in the ATOM -..

Code: Select all

`[Finished in 5.461s]` 
but there remain two little questions:

a. how ot set the default encoding in ATOM !?
b. how - and where set the paths in ATOM !?

i will digg deeper into all that


above all - stay healthy - and all the best to you both!!!

have a great day.


Post Reply