How to install package into an environment from another environment? - python-3.x

Say I have a virtualenv environment myenv1 and another, myenv2. I have some packages installed in myenv1, and I would like to install them on myenv2 as well. Is there a way to install them in myenv2 using myenv1?
I referred to the following link, but apparently that requires a requirement.txt to be present.
However, I have installed many packages on the go, and I do not have a prepared requirement.txt for myenv1. Also, the second step requires downloading the required packages again to a folder. Is there a way to achieve the said without downloading anything again?

Related

How to work seamlessly on a virtualenv on different computers?

I have a virtualenv folder on google drive that I'd like to work on with computer1 and computer2.
However I'm finding that the virtualenv is almost set up for computer1 only. When I CD to the folder with my virtualenv on computer2, activate the virtualenv, and then run the command
python --version
I get the error:
No Python at 'C:\Users\computer1_user\AppData\Local\Programs\Python\Python39\python.exe'
Which is a folder on computer1, not computer2.
Additionally, when going through some of the files in venv/Scripts such as the activate.txt file, it has lines such as:
VIRTUAL_ENV="C:\Users\computer1_user\programming\data_science\python\file\venv"
export VIRTUAL_ENV
Which is a folder on computer1.
Basically, how do I set up a virtualenv that can be accessed, changed, and saved from multiple machines? It seems the setup I have now has too many connections to computer1.
If you share a project with others, use a build system, or plan to copy the project to any other location where you need to restore an environment, you need to specify the external packages that the project requires. The recommended approach is to use a requirements.txt file that contains a list of commands for pip that installs the required versions of dependent packages. The most common command is
pip freeze > requirements.txt, which records an environment's current package list into requirements.txt.
for more information go to pip freeze
If you want to install the dependencies in a virtual environment, create and activate that environment first, then use the Install from requirements.txt command. For more information on creating a virtual environment, see Use virtual environments.

what are the advantages of using pipenv sync over pipenv install?

I am using pipenv to manage my python packages, in my repository, I have both Pipfile and Pipfile.lock versioned. and I want to install all python packages on my live server. should I use pipenv sync or pipenv install? and why?.
From looking at the docs, it looks like pipenv install will install all dependencies from the Pipfile, and update Pipfile.lock with the versions it used.
pipenv sync will install the exact versions specified in Pipfile.lock.
I would say sync is better for getting your environment to match what is checked in, and install is for when you want to get the latest versions, or are adding new dependencies that aren't in the lock file yet.

How to differentiate between manually installed packages and dependencies on linux

I am a noob in linux and right now I am using a raspberry pi with raspbian to learn about it. I am trying the commands to install and uninstall packages (apt) but i have the following doubt.
Is there a way to differentiate between packages that I have installed and packages that were automatically installed because they are dependencies?
Thanks
Is there a way to differentiate between packages that I have installed and packages that were automatically installed because they are dependencies?
Probably not, and that should not matter. Suppose you have some package foo that has been installed as a dependency for bar. A few days latter, you might want to install foo (and since it is already installed, nothing will happen).

How do I restore my Haskell setup to the bare Homebrew configuration?

I have a system setup of Haskell that I've maintained with Homebrew and subsequent cabal install invocations for various packages. I would like to take this back to the bare installation created with brew install haskell-stack.
How do I do this? Right now I seem to have a bunch of stuff lying around (e.g. old docsets, executables like ghc-mod etc.) at the system level, even after deleting all installed packages with rm -r ~/.ghc. Is there a reliable way to get back to the basic configuration that brew install haskell-stack creates?

Installing additional packages for Cygwin

To install additional packages for Cygwin, do I just need to run the setup.exe again and choose from the packages list?
Also, doing this won't harm my computer in terms of 2 Cygwin instances being installed or problems of that kind (I'm kind of a noobie with these things).
Last, there is no package manager in Cygwin which you can run in the command line? Something similar to Pip in Python.
No, adding additional packages doesn’t modify the current settings. There is a
package manager called apt-cyg which installes additional packages from
command-line. To install apt-cyg follow the below steps:
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
Note: wget should be installed for downloading the apt-cyg. To Use apt-cyg for
installing additional package (after following the above steps):
apt-cyg install ncurses
No, it doesn't hurt the current setup. The install program knows what's installed already.
Having said that, I long ago got into the habit of installing all of Cygwin since, despite its size, it's still minuscule compared to the size of modern hard disks. That way, you won't ever have to worry about whether a package is installed or not.
Re-run the setup executable like "cygwin_setup-x86_64.exe" should do it.
"Install from Internet"
Accept your existing root directory (from your existing installation)
Use your existing "Local Package Directory"
On the screen, view "Full"
Search for the new package you want to add
Go through the installation
Additional option, may be helpful for someone:
To install additional packages in windows from windows command line you can use your cygwin installer.
I suppose, you've already downloaded it to install cygwin from here https://cygwin.com/install.html.
$ setup-x86_64.exe -q -P graphviz
see this guide for details:
http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/
There is no package management in Cygwin outside of the setup program. The setup only applies updates to your current installation, it does not overwrite packages than what you already have.
So if you want new packages just rerun the setup program to install packages.
You can just look for the package binaries and decompress them in the C:\cygwin\bin folder.
I did that for dos2unix ( https://cygwin.com/packages/summary/dos2unix.html ) and trying it out now.

Resources