Saturday, December 7, 2019

VSCode Python: Refer global site packages inside virtual environment

Using virtual environments in Visual Studio Code is a great practise while working on python. However, I had noticed that whenever I create a virtual environment, I had to reinstall the commonly used packages like numpy again in the virtual environment folder. The typical size of all such packages for a python program using Keras packages is nearly 500 MB.

Though this is a very good - and probably essential - practise for production environment, I did not want to use up a lot of unnecessary disk place in my study laptop's hard disk. After seraching on internet I could get some solutions to this problem like setting pythonPath variable in settings.json file under the project folder.

But I was curious and wanted to look for other possible options, and finally I found a setting in the pyenv.cfg file under the virtual environment folder. This file has a setting include-system-site-packages. Setting it to true results in the virtual environment automatically refering to global package library folder, like so

home = C:\Program Files\Python36
include-system-site-packages = true
version = 3.6.8

No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...