Can't install packages via pip or npm - python

I'm trying to install some packages globally on my Mac. But I'm not able to install them via npm or pip, because I'll always get the message that the packages does not exist. For Python, I solved this by always using a virtualenv. But now I'm trying to install the #vue/cli via npm, but I'm not able to access it. The commands are working fine, but I'm just not able to access it. I think it has something to do with my $PATH, but I don't know how to fix that.
If I look in my Finder, I can find the #vue folder in /users/.../node_modules/. Does someone know how I can access this folder with the vue command in Terminal?

If it's a PATH problem:
1) Open up Terminal.
2) Run the following command:
sudo nano /etc/paths
3) Enter your password, when prompted.
4) Check if the correct paths exist in the file or not.
5) Fix, if needed
6) Hit Control-X to quit.
7) Enter “Y” to save the modified buffer.
Everything, should work fine now. If it doesn't try re-installing NPM/PIP.

Related

No tray and desktop icons afte python upgrade + additional problems

I have deleted old python versions and installed new python (version 3.5.2) and after i restarted computer I have lost system tray and icons on the desktop. I found some solutions that are based on setting up CCSM over terminal but it's not that simple as it looks like. There is no terminal and no ccsm installed anymore so i have followed one tutorial where you need to click on desktop, create new folder and try to run terminal from /usr/bin/ directory. Because there was no terminal i found xterminal and started with entering commands like DISPLAY=:0 ccsm but i got error "bad interpreter".
Anyways, i found some way to delete and reinstall python and i can see its installed in Python-3.5.0 directory. So i was thinking i start the DISPLAY command thru script and run it with python3.5 someScript.py command. That part was success but then i got error " no ccsm " which is true. So...
1.) i try to install with sudo apt-get install compizconfig-settings-manager
but i got error https://ibb.co/Jdm6BFf
2.) after googling i found some solutions for this but then i land it in the same problem:
https://ibb.co/x8LHFjy
3.) btw. i try to install "minimal" version of python and it was installed but with some errors.
It looks like that path to python is not a problem, because I run the script directly so it must be missing packages, i have no clue how to update it or what to do next...
Purging python and trying to reinstall again ?
Thank you guys for your answers !
E.

Virtual Environment's Activate Does Nothing

So, I switched to my new laptop and tried to install VirtualEnv on the latest version of Python. Even though it is successfully installed, when I create a new virtual environment and try to activate it, it switches to a new line as nothing has happened. I checked the folder, I'm entering the right path, it's not in "bin" folder. I'm not sure what's causing the problem. I have to note that I'm on Windows and I'm not using PowerShell. any ideas?
P.S. Please note that I know that it must show the VirtualEnv's name in parenthesis but unfortunately, it doesn't.
I had this issue earlier today. What solved it for me was running the \scripts\activate.ps1 command in Powershell as Admin
1)Run Powershell as Administrator
2) Run the following command in powershell: Set-ExecutionPolicy Unrestricted
3) Rerun the activation command: > venv\Scripts\activate.ps1

pip in venv on Windows 10: 'Fatal error in launcher: Unable to create process using '"c:\users\..." ' encountered during flask tutorial

I'm going through the Flask tutorial, and I encounter a problem where I can't use pip (and thus anything else really) a venv in Powershell. The same flask app runs correctly in an Ubuntu terminal with Python 3.6.6 in WSL.
The problem seems to depend on the directory, which makes me think it's somehow related to file path length; I enabled long file paths in the windows Group Editor but this hasn't fixed the problem. In the below steps my venv directory is c:\users\rwgpu\google-drive\code\flask-tutorial\winEnvflaskr\ and I experience the error, but everything works correctly in the directory C:\python\test\testVenv. (in each case I'm running the commands in the directory one up from the listed above, flask-tutorial and test respectively)
Minimal steps to reproduce are:
Completely fresh Python 3.7 installation.
Change directory to app folder.
py -m venv winEnvFlaskr
./winEnvFlaskr/Scripts/activate
pip list
The ultimate goal is to then
pip install FLask
and run the Flask tutorial app. Again, all steps work correctly in Bash on Ubuntu in WSL (running its own Python) and in a different windows directory with the same Python 3.7.
After pip list I get the error:
Fatal error in launcher: Unable to create process using '"c:\users\rwgpu\google-drive\code\flask-tutorial\winenvflaskr\scripts\python.exe" "C:\Users\rwgpu\Google-Drive\Code\flask-tutorial\winEnvFlaskr\Scripts\pip.exe" list'
and if I try
python -m pip list
I get nothing; the terminal hangs for a second and returns with no output. If I run
py -m pip install -U pip
in the bugged venv it will try to install and report success. It will do this again, and will never report "requirement already satisfied" which would be correct.
I had the same problem on Windows with running flask in command line from venv(for example, "(venv)...\flask run"). I resolved the problem with changing path in flask.exe code(open "your_venv\Scripts\flask.exe" with notepad or etc.): in my way I correct the 436-th line at the end; you need to put there "your_absolute_path_to_venv\Scripts\python.exe" instead of the path indicated there.
Good luck!
Well, I still don't know why this was happening -- it persisted through deleting and recreating the venv (obviously), but when I deleted the entire folder, that somehow cleared it up. I just copied the code into a new directory in the same parent and everything seems to be working ¯\_(ツ)_/¯
If anyone knows what would cause this in my case I still welcome input.

"python" and "pip" command not found in Command Line [duplicate]

This question already has answers here:
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
(23 answers)
Closed 5 years ago.
I recently installed Python 3.6 for my Windows 10 (64bit) and I want to use pip, but before to install that, I need to execute the following command using the downloaded get-pip.py program:
python get-pip.py
Somehow this doesn't work and I get the following message from Command Line:
'python' is not recognized as an internal or external command,
operable program or batch file.
(I get the same message when I want to execute some pip commands)
I tried a lot of "solutions" for installing pip, like downloading files from https://bitbucket.org/pygame/pygame/downloads/ but nothing happened, I got the messages...
Could you explain to me why the Command Line doesn't know these commands and how can I install them?
No need for admin access:
The reason the error is arising is because python is not in your PATH (meaning it can be called from any directory in the prompt). You can check that its not in the PATH by typing the following:
echo %path%
which will return lost of different directory paths, but not the one to where you have python installed.
To add python to this (and get rid of your error), follow these steps:
Open up control panel.
Go to System. (skip to this step with: Win+Break )
Go to the Advanced tab at the top.
Click on Environment Variables at the bottom.
In the section User variables for ___, add a new one with New.
In this pop-up add the name : path and value : C:\Python34 (or wherever it is installed).
Hope this helps as this is what I did to get python to work from any directory in the command prompt!
Open your CMD as administrator and type PATH (prints the output of your system PATH Variable). There have to be a PATH directing to your Python Installation directory. Only with that system Path your cmd knows where python.exe is and search there for python.
Normally the Python Installation Setup asks if you want to set a Python Environment PATH Variable. Maybe run the setup again and watch out for that option. And I think there was a checkbox to automatic install pip for python.
If you want to set the Path Environment Variable use this:
https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10
If you want to manually install pip with GET-PIP you have to download get-pip.py first and then run it with python.
Download get-pip from here.
https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Could you explain to me why the Command Line doesn't know these
commands and how can I install them?
This happens when Python executables are not added to PATH.
#xyres provided a nice link on how to do this.
I want to use pip, but before to install that, I need to execute the following command
using the downloaded get-pip.py program:
pip should be bundled with the official Python installer, so there should be no need to get it from other sources

pip command does nothing

I just installed Python 2.7.10 on windows 10.
I have added my python and pip directory to my PATH like so:
My Scripts folder looks like this:
My problem is, when I type in "pip" in command prompt and press enter absolutely nothing happens, even if I wait several minutes. If I remove the Scripts directory from the PATH variable I just get the error message like "pip not recognized as internal or external command". Python works fine. I have also tried to reinstall both pip and Python but the same problem occurs.
So, does anyone have any idea about why pip does not do anything?
**Edit: ** when I say it does not do anything, I mean the cmd "hangs", like if it is waiting for something to happen. The cursor just keeps on blinking.
One command that is bound to work is writing:
python -m pip install requests
This works because you hand off the script invocation to python, which you know works, instead of relying on the PATH environment variable of windows, which can be dodgy.
Packages like numpy that require c-extensions to be built, will not work with pip unless you have a C Compiler installed on your system. More information can be found in this question.
If you are, as you're saying, unfamiliar with the python environment, then let me assure you, you will have a better day by installing Anaconda.
Anaconda is a completely free Python distribution (including for
commercial use and redistribution). It includes more than 300 of the
most popular Python packages for science, math, engineering, and data
analysis.
Anaconda comes with numpy, of course.
After Python including pip at package, pip commands not work sometimes.
Then you can use pip through python like
python -m pip <pip commands that you want>
Try disabling your virus scanner. If this fixes it, exclude the C:\Python27\ folder from scanning (at your own risk).
I had this same issue: typing pip on the command line just puts the cursor on the next line, and nothing happens. I was sure my PATH system variable had C:\Python27\ and C:\Python27\Scripts\ in it, and I could verify it using echo %PATH% on the command line.
I found that I had to disable my virus scanner (Avast). I excluded the C:\Python27\ from virus scanning, and now everything works. Apparently the scanner is interfering with Python's ability to load the module.
Add the following path or you can also cd to the path and then try pip command, it will work fine.
C:\Python27\Lib\site-packages\pip
I had the same issue after uninstalling my antivirus, which was blocking the script. The issue was resolved.

Categories

Resources