Forum Archive

StaSh crashes and gives error when trying to do pip install colour

birkicht

Dear Phytonistas,

I tried to install the PyPi package “colour” ver. 0.1.5
I did self update of StaSh.
When I run launch_stash.py, Pythonista crashes.
Second time running the script, the shell is present.
I tried to use python 2.7.
The following message occurs in both python environments:
StaSh v0.7.4 on python 3.6.1 (2.7):
Warning: you are running StaSh in python3.
Some commands may not work correctly in python3.
Please help us improving StaSh by reporting bugs on github.
Tip: Check the current StaSh installation and system information with version
[~/Documents]$ pip install colour
stash: : invalid syntax (pip.py, line 2)
[~/Documents]$

Do you have any clue, how to install site packages to pythonista?

Thank you very much for your suggestions.
Best regards
Matthias

bennr01

Hi,

maybe your stash install is broken. Try updating to the latest version using selfupdate -f dev.

birkicht

Dear Benny,

thank you for your answer and the hint. After the new update I get the same error message.
When I used wget to install openpyxl, the shell worked well.
Only “pip install” is not working. This is a pitty, because a manual install of complex packages is very time intensive in comparison to pypi.

best regards
Matthias

bennr01

@birkicht I just tried and was able to successfully install colour. The error message you posted indicates that the file $STASH_ROOT/bin/pip.py is damaged (python cant parse it's contents). We have tests for the github repo, so we know that pip.py in the repo is working correctly. So the only other option I can think of is that StaSh tries to execute the wrong file.

To test this, could you please do the following:

  1. execute stashconf py_traceback 1. This will enable full tracebacks.
  2. execute which pip and post the output of this command here. This will tell us which file StaSh tries to execute. If you have a file named pip.py in your current directoy, this could cause the issues.
  3. execute pip --verbose install colour annd post the output of this command here. This will show more output.
JonB

@bennr01 shouldn't he use
selfupdate -f bennrr01:dev

bennr01

@JonB said:

@bennr01 shouldn't he use
selfupdate -f bennrr01:dev

It is not important in this case. bennr01:dev is only 10 commits ahead of dev and the only change relevant for pip fixed an AttributeError in certain edge cases.

birkicht

@bennr01 said:

pip --verbose install colour
Dear Benny,

thank for your fast response and your instructions. The error message is following:

—————————————————————

stash: : invalid syntax (pip.py, line 2)
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/F47C5835-515B-4C73-93FB-38B132E4B000/Pythonista3/Documents/site-packages/stash/system/shruntime.py", line 545, in exec_py_file
code = compile(content, file_path, "exec", dont_inherit=True)
File "pip.py", line 2
python -m pip install SomePackage
^
SyntaxError: invalid syntax

—————————————————————

Should I deinstall StaSh and reinstall it. When YES, how do I do that tin the right manner?
best regards, Matthias

birkicht

Sorry, I don’t understand, that deinstalling/reinstalling does not help.
What’s wrong with my Phytonista?

best regards
Matthias

bennr01

stash: : invalid syntax (pip.py, line 2)
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/F47C5835-515B-4C73-93FB-38B132E4B000/Pythonista3/Documents/site-packages/stash/system/shruntime.py", line 545, in exec_py_file
code = compile(content, file_path, "exec", dont_inherit=True)
File "pip.py", line 2
python -m pip install SomePackage
^
SyntaxError: invalid syntax

It seems like StaSh is trying to execute the wrong file. You most likely have a file named pip.py in your current directory. Try executing which pip | xargs rm to remove the wrong file.

birkicht

Dear Benny,

actually there are 5 files/folders with pip in there name.
a folder “pip” in /site packages/stash/tests
a file pip_1.py
two times the file pipista.py in site packages and local packages
a file test_pip.py in /site packages/stash/tests

BUT NO pip.py any more after deinstall and reinstall.

it is not always the same error after calling pip install.
Now:

StaSh v0.7.2 on python 3.6.1
Warning: you are running StaSh in python3. Some commands may not work correctly in python3. Please help us improving StaSh by reporting bugs on github.
Tip: Show a random tip with command totd
[~/Documents]$ which pip | xargs rm
[~/Documents]$ pip install color
: invalid token (pkg_resources.py, line 28)

[~/Documents]$ pip install colour
stash: pip: command not found

It is embrassing me to take your time, but I am not an expert.
Should I have to go for complete removing of phytonista?
Do I have to pay again when I do that?

best regards
Matthias

birkicht

Dear Benny,

after new update to stash 7.4, there is only one pip.py in the path site packages/stash/bin

The same error occurs like in stash 7.2:

StaSh v0.7.4 on python 3.6.1
Warning: you are running StaSh in python3. Some commands may not work correctly in python3.
Please help us improving StaSh by reporting bugs on github.
Tip: You can invoke almost any Python scripts, including UI and Scene, directly from StaSh
[~/Documents]$ pip install color
stash: : invalid token (pkg_resources.py, line 28)
[~/Documents]$

This is line 28 in pkg_resources.py
def _bypass_ensure_directory(name, mode=0777):

best regards
Matthias

birkicht

Dear Benny, dear all,

after a reinstall of pythonista pip install is working well.
Sorry for any inconvenience and thank you for your help.

I really appreciate your support!

best regards
Matthias