Forum Archive

Installing Pygal

macfox2

I'm trying to install pygal. To do this, I pasted pipista into an empty script and saved it in site-packages. I created another empty script in site-packages with the following code, but receive an ImportError that there is "no module named pipista":

import pipista

pipista.pypi_install('pygal')

Pipista appears to be written for Python 2.7, so I set this as my default interpreter, but I'm still having issues. What am I doing wrong? Will my second line of code even install Pygal? Is there anything else I'll need to do?

I'm very new to this so any help is greatly appreciated. Thanks!

cvp

For me no Import error but I put the little script for importing, in the root, not in the site-packages folder.

Even if I put this script in the same site-packages folder, I don't have any import error.
Sure of the name pipista.py?

JonB

Your mistake might be using pipists, which was last updated 4 years ago, and is not supported anymore :)

Try stash, pip command, which is mostly bulletproof.
https://github.com/ywangd/stash

Out of curiosity, where did you stumble upon pipista?

macfox2

Thanks to both of you. I'll try stash. I read about pipista on other threads, like this one: https://forum.omz-software.com/topic/708/using-pipista

macfox2

Thanks again @JonB -- stash worked great for installing Pygal, but now when I go to import pygal, I receive this error:

No module named 'pkg_resources'

Any ideas how to fix this?

JonB

ugh, pkg_resources is a pain...

This:
https://forum.omz-software.com/topic/1933/stash-pip-and-pylint

may be of some help. This might require manually downloading using stash wget, then copying the egg info files into site packages. Also you will need to install setuptools and pkg_resources.

@dgelessus had a "fistutils" which i think allowed setuptools to work on pythonista, but I am not entirely sure.

dgelessus

fistutils was very "experimental" to say the least. It's a hack that only barely works and isn't very useful in the end, there isn't much that fistutils pip can do that stash pip can't.

As for pkg_resources, you could try getting the standard pkg_resources package from https://github.com/pypa/setuptools. I don't have a custom version or patch of pkg_resources in fistutils, which means that the standard version might work unmodified on Pythonista.

ywangd

I tried to download setuptools and copy its pkg_resources sub-folder into site-packages. Then import pygal just worked. Maybe we can make this a standard process to install pkg_resources the first time stash pip is called.

By the way, these are the commands I used to install pkg_resources.

pip download setuptools
tar -zxvf setuptools-25.1.0.tar.gz
cp setuptools-25.1.0/pkg_resources site-packages/

If there are any import errors afterwards, try restart Pythonista.

macfox2

Wow, that worked, @ywangd ! Thank you!