installation pip install dbt-postgres - windows

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.

Related

Migrate Anaconda packages to `venv` virtual environment

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.

pycharm swig how to? [windows]

I would require some guidance in regards to installing a module/package in pycharm (free edition). I have to mention that i have not worked with this IDE yet and wanted to try it out on a little project containing smartcards.
When i try to install "pyscard" i get the error that boils down to
error: command 'swig.exe' failed: No such file or directory
People say just install SWIG, which i guessed already ^^.
The issue i have is that i actually have no idea how to... and none of the pages i found has really enlightended me on this issue.
I downloaded the zip "swigwin-3.0.12" but i am at a loss what to do with it now. EDIT: According to the SWIG page this is an already compiled version and i have to somehow make pycharm recognize that the folder it is in contains the swig.exe it requires.
EDIT2: Adding the folder containing the swig.exe to the PATH variable also did not work ... which i thought would be the issue
EDIT3+Answer:
Ok the link in the comments from "wp78de" was correct my problem was that pycharm/pc restart were needed for it to catch the added PATH variable to the swig.exe (for pycharm that is)
Any advice is appriciated.
Envoirment:
Windows 8.1 Pro 64-bit
Pycharm 2017.2.4
Python 3.6
Basically, you just have to add the directory that contains the swig executable the PATH environment variable. You can do it via CMD or the Windows UI.
If you have added swig to your path, you should be able to call it in the command prompt from any directory: open "cmd", and type swig --help" on that prompt.
A restart of PyCharm (or whatever your IDE is) and Windows might be required.

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.

Copy python modules from one system to another

Is it possibe to copy all of the python modules from one Windows computer to another computer? They are both running the same version of Python 2.7.12.
The reason for doing so is that I have internet access on one of them, and manual installing modules on the other requires to much time because of dependencies.
I suppose you mean "copy the python installation from one system to another" (else the answer is: put your modules on a USB key and copy them to the other system).
the best way
The best way of course would be to install Python properly on the other system using setup. But as you said, all dependencies/external libraries that you could easily get using pip for instance would have to be re-done. Nothing impossible with a small batch script, even if you don't have internet, but you would have to get hold of all the .whl files.
the full treatment, portable-style
But if you cannot you can create a "portable" version of python like this:
zip the contents of C:\python27 to an USB key
copy all python DLLS: copy C:\windows\system32\py*DLL K: (if K is your usb drive)
unzip the contents of the archive somewhere on the second machine
add the DLLs directly in the python27 directory.
(those DLLs were installed in the windows system in previous Python versions, now it's even simpler since they are natively installed in the python directory)
The advantage of this method is that it can be automated to be performed on several machines.
There are some disadvantages too:
python is not seen as "installed" in the registry, so no "uninstall" is proposed. It's a portable install
associations with .py and .pyw are not done. But you can do it manually by altering some registry keys.
another method, better
You can have best of both worlds like this:
perform a basic install of python on the second machine
overwrite the install with the zip file
=> you get the registered install + the associations + the PATH... I would recommend that last method.
Last partial method, maybe best matching your question
Try copying the Lib directory only. It's where the libraries are installed. I'm not 100% sure but it worked for me when I wanted to put wx on a python install lacking wx.
Of course you will copy over already existing files, but they are the same so no problem. I let other people comment if this is acceptable or not. I'm not sure of all the installation mechanism, maybe that will fail in some particular case.
In my case, copy-pasting python installation didn't do the job.
You need to check the "C:\Users\\AppData\Roaming\Python*" folder. You may find installed python modules there. Copy and paste these into your source folder will add these modules to your python.

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