Migrate Anaconda packages to `venv` virtual environment - windows

I have installed Anaconda recently in a new Windows computer. I have no experience with managing installed packages in Windows, but in Linux. I created a new project with PyCharm and chose to use as interpreter Python 3.7 that I installed separate from the Python 3.6 version that Anaconda comes with. Now I want to be able to use Anaconda modules such as numpy or pandas in my PyCharm Project, that is using a virtual environment set up in a PyCharmProjects folder.
I fail to understand how exactly should I do it. What is that I have to copy or run to migrate the Python packages installed in Conda to my Virtual environment created from a clean independent install of Python 3.7? When I try to import them they don't work. Do I have to create a new project and migrate the files or can I do it without that?
Edit
Also, I am very unclear about how I can run Python36 that Anaconda installed. There is no conda command in Windows and python runs python27. How do I do this?

So it seems that using Python in Windows goes a bit differently than in Linux/MacOS. In order to change the default version that runs when python command is executed, one has to run the command regedit and Find (Ctrl+F) Python.exe, and change the path to default Python interpreter that one wants to use. Python installed by Anaconda can be found in Anaconda's folder in C:\ProgramData (if installation was for all users, if not its probably in some other folder in C:\Users\[User].
As for the other part of the question, I'm not sure but I think packages have to be re-installed in the virtual environment, unless you know how to copy the files one by one. Also, it's important to be careful with the version compatibility. In my case, the two Python installations are different versions, so it might not work the trick to copy the files. Other option is to change where the interpreter runs; if in that folder the packages are installed, the installation will succeed. You can also change Python's path to find packages; but that is something that must be done programatically and is not very handy to have to be running those lines of code each time.
When creating a project (or even when the project is already created) you can choose to change the interpreter to Anaconda's Python, even if you are not using conda as a package manager, but virtualenv by Python. That'd be the trick for me. Aditionally, PyCharm also natively integrates package installation into the virtual environment in a GUI menu.
If anyone has a better answer/explanation, I'm looking forward to getting to know it, but in the meanwhile that is the conclusion I have arrived to.

Related

installation pip install dbt-postgres

I guess just installed dbt-postgres according to the article https://docs.getdbt.com/dbt-cli/install/pip
using command pip install dbt-postgres
after the installation I have everywhere Requirements already satisfied
When I try the command to see the version I have an error
''dbt' is not recognized as an internal or external command,
operable program or batch file.'
Does this mean that I didn't downloaded this?
How to check the version?
pip is saying that you already have dbt-postgres installed ("Requirement already satisfied") in your local Python 3.10 environment.
Windows is complaining because that Python's site-packages directory is not on your PATH. This is typical; depending on how you install Python on Windows, it is not automatically added to your PATH. (PATH is an environment variable that tells your shell where to search for the commands you type in -- each command is the name of an executable file in a folder somewhere, and PATH is a list of folders to search in for those executable files).
There are a few ways to add Python to your PATH -- see the official docs on this subject. If you're new to all of this, your best bet might be to uninstall and re-install Python. The Windows Store is now the best way to do this.
HOWEVER there is another issue here too -- you're trying to run dbt on Python 3.10, but currently dbt only supports older versions of Python (3.7-3.9). So when you re-install Python, you're going to want to specify 3.9 (which I linked to above).
Managing multiple versions of Python on your machine can be a real pain, especially on Windows. If you have someone more experienced in your organization (like an engineer who knows Python well), it's well worth your time to get someone to pair with you on this while you work it out.

How to install GnuPlot on windows?

A Unix (mac/Linux) user who has been forced to work on a windows machine here :)
I have scripted loads of work in GnuPlot and don't want to switch to other programs at this moment. I would appreciate it if you could help me know how to install GnuPlot On windows (more specifically windows 10). questions:
I know there are two options according to this page, Cygwin and MinGW. which one is better?
I have MinGW installed and I know I need to install one of the options from this page but I don't know which one(s)! and how.
I have searched the internet but it seems most of the search results are for compiling. I don't want to go through compiling and all the hassle.
I tried installing the binary from this link, and when I try to run the program this is the error I get:
Unable to execute file:
C:\Program Files\gnuplot\bin\wgnuplot.exe
CreatProcess failed; Code267.
The directory name is invalid.
I would appreciate it if you could give me a very simple stepwise installation (1 2 3 ...), preferably with visuals, and instructions.
P.S. A nice way to install Free, Libre, and Open Source Software (FLOSS) on Windows and keep them updated, is to use package managers like Chocolatey. There are GnuPlot chocolatey packages here. Just install choco as instructed here. Then use choco install Gnuplot to have the software installed.
You don't have to install MinGW or Cygwin. Actually packages compiled in MinGW are compatible with Windows. Just download the binary of gnuplot from Their repo and you are good to go.
Additional points:
When installing, check which terminals you want to set up; also
check if you want the installer to add the PATH variable to your
system. Also, create a desktop shortcut.
After installation, you should see the desktop shortcut. Clicking on it should open a terminal-based gnuplot (which hopefully you are familiar with).
Please note that I have used the x11 terminal (you can get this working by installing xming). There are other options such as windows and qt terminals, but I am not an expert on using these.
You should have Administrator rights on this machine.
Right click on MinGW, Run as Administrator, install - should be OK.
Good luck!
BR, Alex
You can try
$~ scoop install gnuplot
Installing 'Gnuplot' (5.4.5) [64bit] from main bucket
gp545-win64-mingw.7z (37.7 MB) [=======================================] 100%
Checking hash of gp545-win64-mingw.7z ... ok.
Extracting gp545-win64-mingw.7z ... done.
Linking ~\scoop\apps\Gnuplot\current => ~\scoop\apps\Gnuplot\5.4.5
Creating shim for 'gnuplot'.
Creating shortcut for GNUPlot (wgnuplot.exe)
'Gnuplot' (5.4.5) was installed successfully!

Having difficulty running pygame 2.7

Every time I try to run Pygame 2.7 version I get this prompt:
Windows cant open this file:
File name: pygame-1.9.2b1-cp27-cp27m-win_amd 64.whl
To open this file Windows needs to know what program you want to use to open it.
Windows can go online to look it up automatically, or you can manually select from a list of programs that are installed on your computer.
What do you want to do?
Use the Web service to find the correct program
Select a program from a list of installed programs
How can this be solved?
I've tried many Youtube videos.
That .whl file that you mention needs to be installed with a command-line tool called pip that comes with python. Assuming you are starting from scratch, here is what you need to do to install python and pygame. Also, as a minor sidenote, you are actually installing pygame 1.9.2 on python 2.7. Assuming you are interested in that particular version of python and pygame, here are the steps you need to follow.
To install python 2.7, you need to first go to the Python Software Foundation's website here. Go to the download section by clicking on the latest link for python 2.7.12. Scroll down and download either the x86 or x86-64 MSI installer (depending if you are on a 32bit or 64bit platform respectively).
Run the MSI installer. Most of the default options should be fine, nothing too tricky here.
After you run the installer, you need to add python to the PATH environment variable so that windows actually knows where python is on your computer. To do this, you need to find the Advanced System Settings section in your control panel (how to exactly get there varies depending on what Windows version you are on).
Once you are there, click the Environmental Variables... button. Under System Variables, we need to edit the value of the Path variable to include C:\Python27\ at the end of it. If all of the path variable stuff is on one line, you need to add a semicolon to separate it from the other paths in the list.
Congrats, now python 2.7 should be installed at this point! To test it out, open up the command prompt and type python. It should open up the interpreter in the command line and should be working.
Assuming it is working, exit out of the python interpreter. In the command prompt, type python -m pip install pygame. This should automatically install pygame for you. If you really want to use your wheel file, cd to the directory where it is installed and type python -m pip install pygame-1.9.2b1-cp27-cp27m-win_amd 64.whl.
Once that is done, you should have both python and pygame installed! Test it out in your IDE of choice (I personally use Geany) and start writing some code! Let me know if these instructions are clear enough.

Multiple parallel MSys/MingW installations on Windows

when installing MSysgit, also MSys (as the name suggests) is installed on my machine.
When I additionally install DevKit for Ruby, yet another copy of MSys is installed on my computer. When installing the Haskell Platform for Windows, again another copy of MSys is installed on my machine. Is there any way of installing MSys/mingw once and tell all other software to do a lookup in the Path?
The version of msys that is included in the Git for Windows package is modified and if you attempt to replace it with a stock msys package you will run into problems. I can't comment on the other packages but basically - it is not worth worrying about. Disk space is significantly cheaper than the time you spend trying to make a number of independent packages share a common msys platform.
However, there are in fact people working on trying to sort that out. msys now has a package management system and I know of at least one project attempting to get the Git for Windows build environment working withing that system mingwGitDevEnv.

EPD Python vs System Python--OSX Mountain Lion 10.8

I'm a two week old mac user, so bear with me here. I'm trying to set EPD python up as my default python interpreter instead of the system python that came with the mac. It was my understanding that EPD does this automatically upon installation by modifying the .bash_profile, but after I installed EPD, the .bash_profile was unaltered and as far as I can see, system python is still the default interpreter. How do I go about changing this?
The major reason why I want to change the default python to EPD is that all the packages I install are automatically placed into the /Library/Python/2.7/site-packages directory instead of the site-packages directory associated with EPD. In particular, I can't get PyCuda to install in EPD's site-packages directory.
I hope this made some sort of sense. I'm lost and not sure where to go from here. Help is greatly appreciated.
Adding the line
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
to your .bashrc file should work.
In theory the EPD installer should have done this job... maybe an issue with permissions?
A few additional points.
Normally the EPD installer makes the PATH changes by adding lines to the bottom of ~/.bash_profile ; if you are sure that it did not, you can also check ~/.profile .
Perhaps you installed EPD as a different user?
Since you say that you are new to Mac, I'll also mention that the PATH would not have been changed in any terminal windows that had already been opened before you installed EPD.
Also, a crucial warning: since you've already installed 3rd-party packages into your system Python, please see this article:
https://support.enthought.com/entries/22094157-OS-X-Conflict-with-installed-packages-in-earlier-Python-installation
You may also find other useful articles in that same Knowledge Base site.

Resources