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

AttributeError: module 'gdal2tiles' has no attribute 'generate_tiles' #7

Open
meteoDaniel opened this issue Jul 13, 2019 · 13 comments
Open

Comments

@meteoDaniel
Copy link

meteoDaniel commented Jul 13, 2019

  • gdal2tiles version: 0.1.5
  • GDAL version:2.3.1
  • Python version: 3.6
  • Operating System: Linux Ubuntu 18.04

Description

generate_tiles function is missing. I am using pycharm, the IDE is referencing to the right function but calling the script within a ipython script in virtual env it is missing.

What I Did

import gdal2tiles
gdal2tiles.generate_tiles(map_file, tile_dir, zoom='3-12')
@machakux
Copy link
Contributor

@meteoDaniel I guess you have a typo in your script

It should be gdal2tiles.generate_tiles. You have a missing s, you used gdal2tile which could be a different module.

@meteoDaniel
Copy link
Author

@machakux thanks, but it was just a spelling mistake in this issue. Error still occures.

@machakux
Copy link
Contributor

@meteoDaniel I couldn't reproduce this issue on my system.

May be you should make sure the package is properly installed (without errors) or you don't have other conflicting packages. You can try reinstalling on a fresh virtualenv.

For me gdal2tiles.generate_tiles is recogized as a function (no AttributeError is raised).
gdal2tiles func

@aidankinzett
Copy link

I'm also experiencing this issue, importing it in the console seems to work, but using it with celery it says that it has no attribute generate_tiles

@aidankinzett
Copy link

I was on GDAL version 2.3, downgraded to 2.2.3 and now its working

@ATNC
Copy link

ATNC commented Feb 20, 2020

Does anybody know how to fix this?

@joaquinbentancor
Copy link

I have the same problem. Someone know how to fix this?

@machakux
Copy link
Contributor

machakux commented Jun 3, 2020

I tried testing with multiple versions of GDAL (including GDAL 2.3.3) and I was unable to reproduce this issue, neither locally nor on Travis.

Basic tests performed are included in tests/ directory (https://github.com/tehamalab/gdal2tiles/blob/master/tests/test_generate_tiles.py) and passing Travis tests with multiple versions of GDAL can be seen at https://travis-ci.org/github/tehamalab/gdal2tiles

My guess is this issue is caused by errors during installation or a conficts in package names.

Unless someone can reproduce this issue on a fresh environment and provide a test script or expicit steps to reproduce this issue, I think this issue can be closed.

@machakux machakux closed this as completed Jun 5, 2020
@ashnair1
Copy link

ashnair1 commented Jan 20, 2021

Don't know about the lower versions but on 3.1.4 (and probably up), GDAL has a gdal2tiles.py and this creates a conflict.
In my case, it opts for

'/home/ashwin/miniconda3/envs/rdet/lib/python3.7/site-packages/GDAL-3.1.4-py3.7-linux-x86_64.egg-info/scripts/gdal2tiles.py'

instead of

/home/ashwin/miniconda3/envs/rdet/lib/python3.7/site-packages/gdal2tiles/gdal2tiles.py

The one from GDAL does not have a generate_tiles function.

@machakux machakux reopened this Jan 20, 2021
@machakux
Copy link
Contributor

It seems GDAL now includes gdal2tiles.py script in its pypi package as @ashnair1 mentioned. Perhaps this package should be renamed to avoid conflicts.

What are other options?

@HelgeDavidSchneider
Copy link

+1 for renaming this package to avoid import problems when GDAL is installed as well.

@mdenno-rti
Copy link

We are experiencing this too. Vote for renaming package.

@simonrp84
Copy link

Likewise, am experiencing the same issue.

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

No branches or pull requests

9 participants