Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't import astetik without internet connection #32

Open
mikkokotila opened this issue Aug 19, 2018 · 8 comments
Open

can't import astetik without internet connection #32

mikkokotila opened this issue Aug 19, 2018 · 8 comments
Assignees

Comments

@mikkokotila
Copy link
Collaborator

When doing import astetik the issue is with countries.csv. Will have to look for a better way to do this.

@mikkokotila mikkokotila self-assigned this Aug 19, 2018
@tjphilpot
Copy link

Ran into this today. Would it be possible to add a countries.csv.gz into astetik\extras simply as a data file that's included with the code? A gzipped CSV is about 5K as opposed to 21k unzipped. Pandas does fine with gzipped csvs. If it's bundled it works around this problem for users like me who would like to use Talos behind an authenticated proxy or on an intranet server.

@mikkokotila
Copy link
Collaborator Author

Looks like this is already fixed:

/Users/mikko/Documents/GitHub/astetik/astetik/utils/country_code.py

It is in fact loading it from extras. If it for some reason throws an error (I tried on my local machine and it didn't, only then it tries to download from online). I've move the respective imports inside the function, so they should not load unless the plot itself is loaded? If there is still issue, could add another exception which simply does nothing (if online also fails).

@tjphilpot
Copy link

The file is there in git, but I don't think it makes it into the source package in PyPi.org.

I downloaded the latest package from PyPI.org: https://pypi.org/project/astetik/#files and the countries.csv is not included in extras.

image

I'm not an expert in Python packaging, but perhaps there's some changes that need to be added to setup.py to include non .py files? https://python-packaging.readthedocs.io/en/latest/non-code-files.html

@tjphilpot
Copy link

tjphilpot commented Oct 19, 2018

Nevermind... I'm clearly not an expert in packaging..

The setup.py has package_data={'astetik.extras': [*]} which should fix this issue, per https://docs.python.org/3/distutils/setupscript.html#distutils-installing-package-data.

I'm just curious why the PyPi.org package doesn't have the data.

When I cloned the repo and installed manually, everything worked as expected.

@JohanMollevik
Copy link

I am still affected by this issue. I get

KeyError: 'astetik\plots\..\extras\countries

both when installing from pip and when runing setup.py

The weird thing is that the files seems to be there in the .egg file, so I do no know what is going on
I'm on windows 10 if it matters

@mikkokotila
Copy link
Collaborator Author

This should now go away finally :)

@JohanMollevik
Copy link

Excelent

@mikkokotila
Copy link
Collaborator Author

It is so. Now it's possible to import astetik without getting the internet connection error. You just have to make sure to have astetik=v.1.9.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants