Forum Archive

cannot install openpyxl

deng

I cann’t install openpyxl in Pythonista on iPad Pro using pip. Please help me!

deng

Additional: I have met the bellowing error.
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: .stashrc is the StaSh resource file similar to what .bashrc is to Bash
[~/Documents]$ pip install openpyxl
Querying PyPI ...
: 'NoneType' object has no attribute 'end'
[~/Documents]$

JonB

Try just pip download openpyxl.
Then, unzip or untar the files, and mv the pyopenxl folder into your site-packages.

Sometimes pip has trouble with fancy setup.py's.

deng

Thank you, JonB. I have settled my issue. I have input “ pip download openpyxl”, but I still have got same error message. Then based on your hint. I have downloaded openpyxl using Safari from PyPI, put it into site-packages. Then openpyxl can work well. Thanks again.

JonB

Sorry, I should have written more words, lol.

Pip download will download a tar.gz or zip to a tmp folder. Then use unzip or tar -xvf to unzip. This creates a folder in the tmp folder, which you can cd to, and then mv the actual code folder to site packages, and finally rm the original tar file.

If using working copy, or the stash git command, you could also clone the repo and get the files that way.

bennr01

It seems like this is actually a bug in the pip/libversion version parsing, so pip download will not help.
I will look into fixing this.

bennr01

Ok, the fix is up. Apparently openpyxl defines python>=3.6, in setup.py and StaSh's libversion did not like the trailing ", ".

This should now be fixed. Please update StaSh to the curent developement branch:

  • selfupdate -f dev
  • then restart pythonista
  • try again

However, I am not sure if pip will correctly handle the minimum python version. There is code in place for checking it, but this depends on the pypi returning the correct requires_python field.

deng

Even I have update and restart StaSh, the issue happen still.
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: Usage of a command can often be checked with the -h option, e.g. git -h
[~/Documents]$ pip install openpyxl
Querying PyPI ...
stash: : 'NoneType' object has no attribute 'end'
[~/Documents]$

JonB

Try

wget https://github.com/chronossc/openpyxl/tree/master/openpyxl/archive/master.zip

This will create a file called master.zip

Then use

unzip master.zip

Which should create a folder master.
Look in that folder, then move the openpyxl subfolder to site packages (there may be a few levels, find the one with actual source code)

deng

Sorry, I have found it is an invalid url

[~/Documents]$ wget https://github.com/chronossc/openpyxl/tree/master/openpyxl/archive/master.zip
Opening: https://github.com/chronossc/openpyxl/tree/master/openpyxl/archive/master.zip

Invalid url: https://github.com/chronossc/openpyxl/tree/master/openpyxl/archive/master.zip
[~/Documents]$

bennr01

@deng said:

Even I have update and restart StaSh, the issue happen still.

Ah, sorry about this. Another mistake on my side. Try selfupdate -f bennr01:dev instead, then restart pythonista. The changes are not yet in the main repo...

JonB

@deng whoops, https://github.com/chronossc/openpyxl/archive/master.zip

But follow bennr's instructions. Will be easier when it works.

deng

Thank you! Benny and JonB, I have successfully installed openpyxl. Benny’s instructions are useful and effective.