DEV Community


Setup python 3.6 enviroment with virtualenv

Originally published at on ・3 min read

My wife ask me to convert few of PDF files to Excell spreadsheet. I did same thing last year by creating some small scripting program in python to do the conversion, but I don’t know where I put my code right now. Maybe lost during formating my laptop last year..haha 😜

I am ζ‡’ right now (guess what I wrote in hΓ nzΓ¬) and I don’t remember how I did last time. Hahaha.. With my Google-fu skill, I found out DfTables offer free API for converting document to another format. Nice! 😬

Fedora 30 comes with python 3.7 installed. Sadly, API doesn’t currently work on 3.7 😲 but no worries since we can create virtualenv to load Python 3.6

Now let install the virtualenv into our workstation, take note I don’t use sudo since my account have administration access, so load with --user args should be enough. I don’t like run something and everthing with sudo.

$ pip3 install --user virtualenv

Download python 3.6 with DNF

$ sudo dnf install python36

Create some directory and cd to that directory. For example I am using ~/workstation/PDF-to-Excell. We will use python 3.6 to install the new python environment:

$ cd ~/workstation/PDF-to-Excell
$ virtualenv --python=/usr/bin/python3.6 python36

now step into the environment using

$ source python36/bin/activate

you should get something like this:

(python36) [rnm@robbinespu PDF-to-Excell] $ python --version
Python 3.6.9

Now let try install DfTables pips

(python36) [rnm@robbinespu PDF-to-Excell] $ pip install git+
Collecting git+
  Cloning to /tmp/pip-req-build-yg3u92jx
  Running command git clone -q /tmp/pip-req-build-yg3u92jx
Collecting requests (from pdftables-api==1.1.0)
  Downloading (57kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 61kB 682kB/s 
Collecting certifi>=2017.4.17 (from requests->pdftables-api==1.1.0)
  Downloading (157kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 163kB 2.1MB/s 
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->pdftables-api==1.1.0)
  Downloading (150kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 153kB 10.6MB/s 
Collecting idna<2.9,>=2.5 (from requests->pdftables-api==1.1.0)
  Downloading (58kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 61kB 10.6MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests->pdftables-api==1.1.0)
  Downloading (133kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 143kB 11.2MB/s 
Building wheels for collected packages: pdftables-api
  Building wheel for pdftables-api ( ... done
  Created wheel for pdftables-api: filename=pdftables_api-1.1.0-cp36-none-any.whl size=5779 sha256=3e99b8595945f9ec3251e8d27e329f14f6783353b7d98d0a3cbc5fb35de53fa0
  Stored in directory: /tmp/pip-ephem-wheel-cache-c1feg25z/wheels/49/66/c0/e4f778e772a77892a98b3aaaba300cbb27a29a07e0c225cd80
Successfully built pdftables-api
Installing collected packages: certifi, urllib3, idna, chardet, requests, pdftables-api
Successfully installed certifi-2019.6.16 chardet-3.0.4 idna-2.8 pdftables-api-1.1.0 requests-2.22.0 urllib3-1.25.3

It working, nice! Currently, We have isolated python 3.6 virtual enviroment and successfully installing required pips for Pdftables dependencies and now, let have some fun 😍

Discussion (0)