python packages open new window - windows

I installed python27 64-bit on windows 7. I also have setuptools and pip installed. Now when I execute command in windows console new console window appear, message is printed in it and close before i can read something from it. e. g. I installed yolk and when type yolk -l in cmd it shows me all packages in new cmd window and close immediately. What should I do if I want all messages in main command window?

When you run pip or easy_install from the command-line, your system will be starting easy_install.exe or pip.exe. As of Python 2.7 x64 these executables have a manifest file to satisfy Windows 7's UAC requirements. You can read a little more about this here, but in short, because the applications could be running with different permissions, a new window is opened.
I don't believe there's a proper fix to get around this, short of downgrading. However, you can bypass the problem by not using the executable files.
Back up and then remove pip.exe, easy_install.exe, and fab.exe (if you have Fabric).
Create a bunch of batch files matching the original binaries' names, and put them in the same folder that had the binaries (default C:\Python27\Scripts).
easy_install.bat
#echo off
easy_install-script.py %*
pip.bat
#echo off
pip-script.py %*
fab.bat
#echo off
fab-script.py %*
With these in place, you should find your command-line use of these tools doesn't spawn a new window. Happy hacking.

I tried these, but still a new terminal opened. So i ran the cmd as an administrator, and python worked fine.

try specifying the commands like so:
c:\python27\python.exe -m easy_install Django==1.6.5v

I have the same problem, but it repairs when I turn off an Antivirus.

try specifying the commands like so:
c:\python27\python.exe -m pip install Django==1.6.5v

Related

How to PATH pip from Spyder(anaconda3) to use in windows 10 command prompt

I use Spyder(anaconda3) to do much of my python work and I can use pip install directly from the spider console but not from windows 10 command prompt. Is there a way to PATH pip install from the spider/anaconda program to work directly with the command prompt?
Is this something that is strictly necessary or even useful to do, can the spider console handle all that is required (even non python instilations) without bothering with the windows comand prompt? For example if I were to run
pip install jupyterlab
from the spider console would this be an issue or would it make more sense to run it from the command prompt? (I know jupyterlab is included in annaconda I was just looking for an exapmle)
The only difference between running the Windows command shell from Spyder is that Spyder will automatically activate your conda environment. You can achive the same thing by running
conda activate
as the first command in your Windows cmd shell.
Alternatively you can start the cmd shell via the "Anaconda prompt" in the Windows Start Menu.

Can't get pip working with psychopy install

I am very new to python and plan to use psychopy quite a lot. I am on a work computer but have full admin rights.
Psychopy came with python version 2.7.11 and includes setuptools already.
I am trying to install the selenium module, but having trouble getting pip to work at all.
In cmd, it is recognising the 'python' command, so I know python is in my path.
I get the message "can't open file 'pip': [Errno2] No such file or directory" from:
python pip install selenium
I get " 'pip' is not recognised as an internal or external command" from:
pip install selenium
When I change directory to where pip is located, I get:
Fatal error in launcher: Unable to create process using '"'
Using pip2 makes no difference.
It seems a simple thing but where am I going wrong with this?!
I never really got to the bottom of this, but this is what I found out and here are the commands that worked for me in Windows. Be aware that I am far from expert!
To run python scripts (*.py) from command line (cmd) then C:\PsychoPy2 and C:\PsychoPy2\DLLs need to be in path. ('Path' contains directories or file extensions that can be more globally accessed, i.e. do not require you to change the prompt to the relevant directories first).
To check, open cmd and either type echo %PATH% or just type python. (If python starts, the line will say >>>. You can exit by typing quit())
To add to path, get properties of computer, then advanced system settings, then environment variables.
To check pip.exe (a sort of installation wizard) is installed, either search for the file, or check C:\PsychoPy2\Scripts for it. This may also need to be in path.
To reinstall the latest versions of pip and setup tools, I went to cmd and typed:
python -m pip install -U pip setuptools
If the same code did not work for other modules (which in my case was due to network access), then I downloaded the wheel file (*.whl) for that module (from their website) and ran the following code:
python -m pip install c:/modulename.whl
These may not be the correct ways of doing things, but they worked for me when I couldn't get other ways to work!
I've just had the exact same issue with the pip install, and a conflict with PsychoPy installations. I think it's because python automatically wants to call on the path that's been set by Psychopy, so it can't get to the 'pip' folders that for me, remain in a temporary/hidden file. This wasn't intuitive for me - on any machine without psychopy python just 'works' when you download it.

How do I install Git for Windows software to a specific directory?

I have just downloaded the latest Git for Windows installer, v2.4. It appears to want to install to the standard Windows "Program files" (with-spaces-in-name) directory.
Since I have all my development code in a folder called (simply) "/bin" -- I want to see if there's a command line option or parameter to change the install directory.
In my case, these days I use a environment variable such as GIT_HOME for important software like git; so it would be useful if there was a way to apply that to things like git commands, etc once I have the program installed.
possibly related:
How do I change the directory in Git Bash with Git for Windows?
I also came across a few questions asking: "whereis git". That's answered above, however I take that as an indicator that others may want git somewhere else too.
To start the installer with a different installation path you can open a CMD terminal in the same directory as the installer executable and pass in an option parameter of /DIR="x:\dirname"
For instance, if you have version 2.17.0 for Windows 64bit and you want to install git to D:\git, you would run:
Git-2.17.0-64-bit.exe /DIR="D:\git"
The installer will launch as usual and you need to walk through the other options, but the install location will be the path specified.
Since I just ran into this problem because my SSD is filling up, I figured I'd share the solution I came to on Windows 11 with Git v. 2.37.2.
The best way I could figure was to uninstall Git, then in CMD Prompt use the suggested command from the Git website with an appended --location/ -l flag:
winget install --id Git.Git -e --source winget --location [drive:/directory]
where [drive:/directory] is your target for the install. Had no issues and verified it worked with a project.

Bower Init Register requires an interactive shell error

this is what I get when I use bower init
what could be the problem??
The problem is with the terminal/console you're using to.
I ran into this same problem other day, I was using Git bash as my terminal, and trying to run this command with Node.js command prompt worked normally.
Try to use another terminal, like cmder (I really recommend this to Windows users), Node.js command prompt or even Windows cmd itself. Hope to have helped you. Best wishes!
The solution is to install GIT bash and avoid
using MinTTY and follow the documentation. Here is the solution:
Uninstall existing GIT bash Reinstall GIT bash Set up during
installation:
Select Use Git from the Windows Command Prompt
Select Checkout Windows-style, commit Unix-style line endings
Select Use Windows' default console window
Okay this works for sure -
Go to https://cygwin.com/install.html and download either the
32 or 64 bit version of Cygwin.
Run the install and install it onto one of your drives.
Run the Cygwin.bat and you will get the same command line
interface.
When you run bower init, it will work just fine. The Mintty that
comes with GIT is broken for somethings. Use the shell that comes
with Cygwin and you will be fine.
It works for me no problem. I used the 64 bit version on a Window 8 64bit OS. Good Luck!
You're most likely running C:\Program Files\Git\git-bash.exe and can instead run C:\Program Files\Git\bin\bash.exe to eliminate the issue. This avoids having to install another yet another terminal.

sudo command not found on Cygwin

I am currently trying to install and update a few packages on a Windows OS. The only matter is that I am using Cygwin in order to type the commands through a terminal (as I'm aware, I can type in Linux type commands such as cd, ls etc. on Cygwin - I may be wrong). However, when I try to install a package like:
sudo apt-get install paparazzi-dev
I get the reply:
-sh: sudo: command not found.
Does anyone have an idea as to how I can fix this problem?
Run cygwin as administrator.. then you wouldn't need any sudo command.
Cygwin is not a full Linux distribution. Therefore you don't have sudo or the Debian/Ubuntu package manager apt-get. There is a number of packages available from the Cygwin repository: http://cygwin.com/packages/
You have to chose these packages during setup.
Windows does not have sudo, apt, or almost any Linux commands to be exact. Cygwin may allow some, but as programs are not installed on Windows as packages apt-get will not work. Windows programs have installers as .exe or .msi instead.
The Windows version of sudo is called runas in case you need to run something as another user. Or, you can run Cygwin as administrator.
If you have to use the packages you need Linux. You can install it directly to replace Windows, dual-boot or use a virtualization software like VMware VirtualBox.
Making out an explanatory answer from answer here by #Aimal as it worked for me.
Cygwin may not get permissions to create folders and files when run by clicking Cygwin icon that's in normal mode.
Cygwin gets the right authorization only when right click -> "run as adminitrator" on cygwin icon because of that it gets permissions to create folders and files.
Cygwin lets you run certain commands, such as cd, ls, or mv; but it doesn't let you run other commands, such as sudo or apt-get.
If you're trying to add a package to your Cygwin installation, rerun Cygwin Setup. It may still be in your "Downloads" folder. Go through all the steps again. The Cygwin installer will automatically download and install the package you want, and add it to your Cygwin installation. (I think it will probably also upgrade all your other installed Cygwin packages to the latest available versions.)
If your desired package isn't on the Cygwin package list but is on the Cygwin Ports package list, follow the Cygwin Ports installation instructions. Note that Cygwin Ports is separate from Cygwin. Please do not send messages about Cygwin Ports packages to the cygwin.com mailing lists.
If you have years of Linux experience, you may be able to compile the software you want inside Cygwin. This can be challenging.
Perhaps an option simpler than "compile it yourself" is this: You can install VirtualBox, then install your favorite Linux distribution inside the virtual machine, then install your desired package inside Linux. (I like Ubuntu Linux, which has more than 27,000 packages in its "Universe" repository.) Now you can run Linux and Windows at the same time.
I think I tried steps below after doing some research & succeeded (on windows)
1.Install scoop using powershell 3 (iex (new-object net.webclient).downloadstring('https://get.scoop.sh'))
2. do scoop install --global sudo
3. make sure paths (C:\Users\\scoop\shims & C:\ProgramData\scoop\shims) added in environmental path variable.
In my case, I wanted to install curl, but could not create directory /usr/local/curl/lib when running command "make install", because of permission deny. so i need to change /usr/local permission. when i run sudo chmod 755 /usr/local, sudo command not found.
after searching a few solution, found that sudo is not installed by default in Cygwin. But I tried the solution that Aimal gave which is to run Cygwin as administrator. I finally can change the folder permission. Thanks Aimal.

Resources