How to install package file to virtualenv folder? - virtualenv

I need to install python packages into a virtualenv. The virtualenv is placed on a ramdisk, and I want the actual files to be installed in the virtualenv folder so that I can benefit from the the lower latency when loading.
It is not clear to me from the documentation I have seen if the package files are downloaded (or imported from global) to the virtualevn folder, or stored globally with only a reference to the version in the virtualenv (ambiguity on import/access).
Which is default behaviour by virtualenv? I can not see the size of the venv folder increasing as I install packages.
Folder size before installing pandas, numpy, scikit, tesorflow,
keras: 4k
Folder size after: 4k
If importing the package files is not default behaviour, how can I install packages to the virtualenv folder and set the interpreter to load the installed packages from the folder?

Related

Put existing virtualenv projects into virtualwrapper

Let's say that I have already created a virtualenv project by virtualenv venv. What is the best way to add this project to virtualwrapper? The way I can think of is creating a virtualwrapper folder, figuring out package dependencies, put the virtualenv project directory into virtualwrapper folder, and then install necessary packages. Is possible to avoid this tedious process?
No, virtualenvs are not portable, you cannot move existing virtualenv to $HOME/.virtualenvs where virtualwrapper stores it virtualenvs. Recreating is the only way.
There is one thing you can simplify — list installed projects with their versions and reinstall exactly that versions:
# In the venv
pip freeze > requirements.txt
deactivate
# Activate a new virtualwrapper-managed venv
workon newenv
pip install -r requirements.txt

How install an Emacs package from file

I have Emacs installed on an internal PC in the organization that is not open to the Internet.
For the sake of that question I'd like to install the "auto-complete" package.
I have downloaded a tar file from MELPA and a zip file from GitHub and copied them to my organization PC.
Now how can I install the auto-complete package using either the tar or zip file?
By the way I see in MELPA that the auto-complete package depends on the
pop-up 0.5.0 package.
Should I install that before?
See C-h f package-install-file
And yes, you will need to manually install any dependencies first, if Emacs will not be able to fetch them on its own.

Uploading venv folder on github

Is it necessary to upload venv folder that itself contains 100's of files along with other folders and files of the same project to GitHub?
Simple answer no. In your gitignore file add the venv to ignore all the files inside your venv fold. Basically your venv fold store all the dependency for your projects, you could use pip freeze to generate the requirement.txt which others can use this file to reproduce the same environment as you did. Plus, the files inside your venv will be huge because it contains entire packages you installed.
You don't have to do that. What you can do is :
Remember your project python version.
Generate your Django project dependencies file requirement.txt.
-Create requirement.txt file use: pipreqs /path/to/your/project/ (I recommend pipreqs, it creates a project level requirement.txt file. You can also use pip freeze or other commands)
-Install all dependencies from it: pip install -r requirements.txt, make sure pip belongs to your virtualenv python other than OS default pip
Then you can easily install a brand new virtual env and install all dependencies.

Why is eclipse installing everything on my C drive?

I have limited space on my C drive, hence installing Eclipse in my E drive. After installation I find that about 1mb is on my E drive and all the rest is on my C drive!
Any idea how to get Eclipse to actually install in the folder I want? in previous versions all plugins went into the plugins folder of the install, but it seems Neon wants to install everything into a .p2 folder in my user folder.
Which is pretty useless too if I wanted Eclipse to be available to other users too...
thanks.
It appears that you downloaded the Windows installer version, which I would avoid if at all possible. While it is possible to tweak your installation to behave as expected, I suggest uninstalling it and downloaded the package of your choice from Eclipse Downloads. Unzip the package on your E: drive. The resulting eclipse directory will house all current files and plugins and others as you add/download them. The .p2 directory will still be created in your user directory, but will not contain anything other than some user-specific configuration information.
You can create a shortcut to eclipse.exe or on Windows 10 right-click and Pin to Start for easy reference. Also make sure that any workspaces you create are created someplace other than your user directory.

Remove library from pythonpath

I checked out twisted source code form svn and opened it using eclipse as a Python project. But I also have twisted installed in my system under /usr/lib/python2.6/dist-packages. So the imports in the source code imports the installed version and not the version I checked out from svn.
How can I remove the installed version from the libraries that PyDev searches?
Removing /usr/lib/python2.6/dist-packages from PYTHONPATH is not an option because twisted depends on some of the libraries in that directory ( such as serial library )
When you make a launch in PyDev, it should add the PYTHONPATH of the project(s) before the PYTHONPATH of the interpreter, so, if you create a project with the twisted source code and set the PYTHONPATH (i.e.: source folder) for that project properly, it should find it before the one in the interpreter.
Note that other projects should reference the twisted project you configured in order to access it.