nativescript-cli icon indicating copy to clipboard operation
nativescript-cli copied to clipboard

WARNING: The Python 'six' package not found.

Open NickIliev opened this issue 6 years ago • 31 comments

From @obiwankenoobi on April 18, 2018 11:52

after installing NativeScript on my macos using ruby -e "$(curl -fsSL https://www.nativescript.org/setup/mac)" I ran into error while typing tns doctor which tells me WARNING: The Python 'six' package not found. and when I trying to install six by pip install six I get the message : Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.4.1) so there is six installed but yet it wont let me move on because of it

Copied from original issue: NativeScript/NativeScript#5699

NickIliev avatar Apr 18 '18 12:04 NickIliev

@obiwankenoobi what is your OS perhaps El Capitan? If so try this solution

pip install --ignore-installed six

NickIliev avatar Apr 18 '18 13:04 NickIliev

Hi @obiwankenoobi,

Can you please try to execute python -c "import six" command and send us the output?

Fatme avatar Apr 18 '18 13:04 Fatme

my OS is High Sierra 10.13.4 and pip install --ignore-installed six didnt worked.

$ python -c "import six" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named six

obiwankenoobi avatar Apr 18 '18 13:04 obiwankenoobi

Hi @obiwankenoobi,

Can you please try to reinstall it?

pip uninstall six
pip install six

Fatme avatar Apr 18 '18 13:04 Fatme

$ pip uninstall six Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

obiwankenoobi avatar Apr 18 '18 13:04 obiwankenoobi

I uninstalled NativeScript and reinstalled it and those are the packaged I missing

`There seem to be issues with your configuration.

✔ Getting NativeScript components versions information... ✔ Component nativescript has 4.0.0 version and is up to date.

✖ Component tns-core-modules is not installed.

✖ Component tns-android is not installed.

✖ Component tns-ios is not installed.

✔ Your ANDROID_HOME environment variable is set and points to correct directory. ✔ Your adb from the Android SDK is correctly installed. ✔ The Android SDK is installed. ✔ A compatible Android SDK for compilation is found. ✔ Javac is installed and is configured properly. ✔ The Java Development Kit (JDK) is installed and is configured properly. ✔ Xcode is installed and is configured properly. ✔ xcodeproj is installed and is configured properly. ✔ CocoaPods are installed. ✔ CocoaPods update is not required. ✔ CocoaPods are configured properly. ✔ Your current CocoaPods version is newer than 1.0.0. ✔ Python installed and configured correctly.

✖ WARNING: The Python 'six' package not found. `

dont know what to do

obiwankenoobi avatar Apr 18 '18 14:04 obiwankenoobi

Hi @obiwankenoobi,

Python six package is needed only for debug command. So all other {N} commands should work as expected.

Fatme avatar Apr 18 '18 16:04 Fatme

yeah but I can't tns run ios so how would I test my app without it?

obiwankenoobi avatar Apr 19 '18 10:04 obiwankenoobi

@obiwankenoobi,

Can you try to execute pip install -U six?

Fatme avatar Apr 19 '18 10:04 Fatme

`$ pip install -U six Requirement already up-to-date: six in /Library/Python/2.7/site-packages (1.11.0)

$ tns run ios ✔ Xcode is installed and is configured properly. ✔ xcodeproj is installed and is configured properly. ✔ CocoaPods are installed. ✔ CocoaPods update is not required. ✔ CocoaPods are configured properly. ✔ Your current CocoaPods version is newer than 1.0.0. ✔ Python installed and configured correctly. ✖ WARNING: The Python 'six' package not found. This package is required by the Debugger library (LLDB) for iOS. You can install it by first making sure you have pip installed and then running 'pip install six' from the terminal.`

obiwankenoobi avatar Apr 19 '18 11:04 obiwankenoobi

Just guesting, but it might be related two more than one python available on the machine.

six might be available for one of them, but may be CLI check the other python availalbe on the machine.

@obiwankenoobi If I'm in this cause this is what I'll try:

  1. Run which python, the output should be some path, for example /usr/local/bin/python
  2. Run ls -la on the path to check where it points (run ls -la /usr/local/bin/python in my case)
  3. Then find pip of this python installation (it should be in the same bin folder where python executable is located) and run <path-to-pip>/pip install six.

dtopuzov avatar Apr 23 '18 06:04 dtopuzov

Just reproduced the issue on brand new macOS High Sierra.

Here is what happens: tns doctor fails because six is not found. This happens because python -c "import six" fails. On the other side pip install six says Requirement already satisfied.

Here is how I was able to workaround it:

sudo pip install --upgrade pip
pip install --user --upgrade matplotlib
pip install six

dtopuzov avatar Apr 23 '18 07:04 dtopuzov

Hi @obiwankenoobi,

Do you have the chance to try the above suggestion?

Fatme avatar May 02 '18 08:05 Fatme

The solution proposed by dtopuzov fixes the issue on MacOS High Sierra 10.13.4

elalienx avatar May 15 '18 09:05 elalienx

@Fatme The solution above makes doctor happy, but most likely it happens on all brand new macOS High Sierra machines. I think we should check if we still need this python package. I think it was required for debug with iOS inspector, which now is not the default option.

May be we can also consider doing this check only when user try to use the command that need this package.

dtopuzov avatar Jun 08 '18 13:06 dtopuzov

Also works on 10.13.6 plus I had to first install pip. sudo easy_install pip

then, only pip install --user --upgrade matplotlib pip install six

The first command failed on ownership and lack of cache setting.

Without this, Sidekick failed to instantiate it's user interface.

HunterTKingsley avatar Aug 16 '18 20:08 HunterTKingsley

I had the same issue. I solved it with listing modules

(Python 2.7.15) pip2 list and (Python 3.6.5) pip3 list

tns uses pip2 in my case (Mac 10.13.6)

I did pip2 install six

after that

tns doctor fund six package

verbotenj avatar Aug 31 '18 07:08 verbotenj

I am just installing local files to build local NS projects.

Output tns doctor

MacBook-Pro-7:TestApp augustopissarra$ tns doctor ✔ Getting environment information

There seem to be issues with your configuration. ✔ Getting NativeScript components versions information... ✔ Component nativescript has 5.0.0 version and is up to date. ✔ Component tns-core-modules has 5.0.2 version and is up to date. ✔ Component tns-android has 5.0.0 version and is up to date. ✔ Component tns-ios has 5.0.0 version and is up to date. ✔ Your ANDROID_HOME environment variable is set and points to correct directory. ✔ Your adb from the Android SDK is correctly installed. ✔ The Android SDK is installed. ✔ A compatible Android SDK for compilation is found. ✔ Javac is installed and is configured properly. ✔ The Java Development Kit (JDK) is installed and is configured properly. ✔ Xcode is installed and is configured properly. ✔ xcodeproj is installed and is configured properly. ✔ CocoaPods are installed. ✔ CocoaPods update is not required. ✔ CocoaPods are configured properly. ✔ Your current CocoaPods version is newer than 1.0.0. ✔ Python installed and configured correctly. ✔ Xcode version 10.1.0 satisfies minimum required version 9. ✖ WARNING: The Python 'six' package not found. This package is required by the Debugger library (LLDB) for iOS. You can install it by first making sure you have pip installed and then running 'pip install six' from the terminal.

I am using Mac OS 10.14.1 (Mojave)

I have tried all of the above, none solved the issue.

abernardobr avatar Nov 12 '18 17:11 abernardobr

After many trials and errors, not sure if it will fix again but, I used the following command:

sudo pip install --ignore-installed  --upgrade six

I removed the sudo to check the version. Latest is 1.11.0.

abernardobr avatar Nov 12 '18 23:11 abernardobr

I had to run the following to fix the issue

brew uninstall --force --ignore-dependencies python@2
brew uninstall --force --ignore-dependencies python
brew install python
brew install python@2

smitcham avatar Nov 13 '18 03:11 smitcham

Solution for Mac OS Catalina. Set your PYTHONPATH environment variable to /Library/Python/2.7/site-packages.

You can do this for your current termincal instance with: export PYTHONPATH=/Library/Python/2.7/site-packages

OR add it permanently to your ~/.bash_profile file. (note you will need to restart your terminal window after doing this.)

See: https://stackoverflow.com/questions/29485741/unable-to-upgrade-python-six-package-in-mac-osx-10-10-2

donovancarthew avatar Oct 16 '19 23:10 donovancarthew

I couldn't get NativeScript to switch to my Python 3 installation, and my system Python 2 framework didn't have pip. sudo easy_install pip did not work for me. The following did:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py Then I needed the full path to the new pip2 installation, which was given during the installation above. Copy yours from the installation message; my path and the rest of the command for installing six looked like this: /Users/matt/Library/Python/2.7/bin/pip2 install six

msisinni avatar Apr 09 '20 20:04 msisinni

I have run a few commands, and after run this "python -m pip install --upgrade six", I tried again, and it works. Maybe you can try run this first to see if if fixed or not.

cavaon-wayne avatar Dec 15 '20 09:12 cavaon-wayne

for me help. pip3 install --ignore-installed six If you are not have pip3 install it

alTach avatar Jul 15 '21 10:07 alTach

I tried what you explain but nothing changes. I'm using Monterey on a M1 Pro chip and did the aliases to point to python3 and pip3. It used to work but after a ns clean I'm facing the below issue.

I suspect NS to use sh (where aliases are not configured) instead of zsh.

If you have any trick for me, I'm taking it! Thank you!

✖ WARNING: Couldn't retrieve installed python packages. We cannot verify your python installation is setup correctly. Please, make sure you have both 'python' and 'pip' installed. Error while validating Python packages. Error is: Command failed: python -c "import six" python: error: Failed to locate 'python'. xcode-select: Failed to locate 'python', requesting installation of command line developer tools.

✖ WARNING: The Python 'six' package not found. This package is required by the Debugger library (LLDB) for iOS. You can install it by first making sure you have pip installed and then running 'pip install six' from the terminal.

Your environment is not configured properly and you will not be able to execute local builds. Verify that your environment is configured according to the system requirements described at https://docs.nativescript.org/environment-setup.html#macos-ios.

phenric avatar Jun 11 '22 15:06 phenric

@phenric what are the symptoms, errors?

When you run any ns command it simply uses your current shell + environment (nothing funky going on there)... But simply doing an alias will not work because XCode on the other hand does not load user shell profiles - that's why we recommend doing a symlink into /usr/local/bin which is a path that the whole system uses including XCode.

Now there is an issue with the system installed python I noticed, it prompts to install additional command line tools, but then does nothing. I shared a workaround a few times on discord (and one of the github discussions) which should work:

brew install python
sudo ln -s -f $(which python3) /usr/local/bin/python

# -s - symbolic
# -f - force - overrides existing links if necessary

This may not work if somehow the freshly installed python isn't the default (brew will usually print a warning/instructions if that's the case), but essentially you need to create a symlink in /usr/local/bin that points to the brew installed python3.

rigor789 avatar Jun 12 '22 14:06 rigor789

Hi @rigor789 Thank you for your time. I don't understand why it used to work before ns clean. I also have a default python3 installed here -> /usr/bin/python3.

I use the command provided in the guide sudo ln -s $(which python3) /usr/local/bin/python and it sill ask me for a fresh new installation with XCode as you mention. I'll try with brew and let you know if it works but if you could explain me the reason I'd highly appreciate. Again thx your answer.

phenric avatar Jun 12 '22 15:06 phenric

Not quite sure why the system installed python refuses to work when being symlinked - I'm guessing they are doing some funky invocation checking on boot...

rigor789 avatar Jun 12 '22 15:06 rigor789

@rigor789 Thank you for the time you gave to the community. I fix the issue by using HomeBrew's python3 instead of the default one. I symlinked as you explain and removed the aliases I previously wrote.

phenric avatar Jun 12 '22 16:06 phenric

I was having the same issue as @phenric, ended up installing python through brew and symlinking to the path given by the brew install as well.

For me the whole process looked like this:

  • brew install python
  • look for line Python has been installed as in install script output
  • sudo ln -s -f path from above line /usr/local/bin/python
  • python(now pointing to brew installed python through sym link) -m pip install --upgrade pip
  • python -m pip install six

Hope this helps someone, spent way too much time on just this issue.

integrojeff avatar Jun 15 '22 18:06 integrojeff

Looks like tns is trying to run python as sh. Open your terminal and run sh, here I was unable to run python or pip.

For me it started working after I aliased python and pip to python3 and pip3, I also had to run @rigor789's symlink stuff for both python and pip.

linesharina avatar Jun 16 '22 08:06 linesharina

On MacOS Ventura (13.1) I had to create the following symlink to fix this issue:

sudo ln -s /Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/usr/bin/python

Here's the output of ns doctor ios before adding the symlink (which fixes both of them):

✖ WARNING: Couldn't retrieve installed python packages. 
 We cannot verify your python installation is setup correctly. Please, make sure you have both 'python' and 'pip' installed.
Error while validating Python packages. Error is: Command failed: python -c "import six"
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
 
✖ WARNING: The Python 'six' package not found. 
 This package is required by the Debugger library (LLDB) for iOS. You can install it by first making sure you have pip installed and then running 'pip install six' from the terminal. 

Moongazer avatar Feb 28 '23 17:02 Moongazer

Can't believe I spent a whole day trying to figure this out lol

Anyways, I'll post what worked for me here.

So, I linked python 3.11 (brew installation) to python ln -s /opt/homebrew/bin/python3.11 /usr/local/bin/python

Then, downloaded the get-pip.py file and run it (Thank you @msisinni) curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py

Then, I simply installed six python -m pip install six

After a ton of trial and error this was what worked for me, hope it helps ^^

JJJJJJJJJJJJJJJl avatar Apr 04 '23 17:04 JJJJJJJJJJJJJJJl

Starting with 8.5 - it should no longer be necessary to alias python - only need python3 in your path and then pip3 install six to make sure you have the six package.

rigor789 avatar Apr 04 '23 20:04 rigor789

This isn't correct. I also experienced the same issue for arm64 and installing the six package was required, but it wouldn't work because the package refers to a copy of the python install in /opt/homebrew/Cellar/pgcli/4.0.0/libexec/lib/python3.12, so you need to manually refer to that version or it doesn't work. It doesn't use the locally installed version for me at all.

jcman76 avatar Nov 01 '23 23:11 jcman76