Feature Request: Duckdb extensions as pip extras #39
Replies: 7 comments 3 replies
-
Yes this feature would be very useful currently I am facing the following error. Install it first using "INSTALL httpfs". |
Beta Was this translation helpful? Give feedback.
-
I also would love to see this feature. I work in an environment that is walled off from the internet. Only recently were we allowed to install anything on pypi through a proxy (before that, there was an internal mirror repo that was maintained for shorter list of packages). Anything outside of that is completely unreachable. To say the least, it's very unexpected for a python package installed from pypi to require strange automatic installs from external repositories as well. It feels strange, from a security perspective, to normalize the automatic downloading and installing of packages at runtime. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
I have just created a repo to download the extensions from duckdb repo and upload them to pypi. I have also added utility function to load the extension in duckdb. pip install duckdb-extensions duckdb-extension-spatial and then in python from duckdb_extensions import extension_importer
extension_importer.import_extension("spatial") I really wish we don't have to maintain this for long and publishing to pypi becomes a core feature. |
Beta Was this translation helpful? Give feedback.
-
I've made a similar version except that it installs the extensions into the same layout that duckdb expects, which allows duckdb to directly load the extensions from a virtualenv instead of having to first install it/pollute ~/.duckdb, keeping the entire process relocatable/self-contained to within a single virtualenv. So you can do something like
And it installs them into e.g. Then you can either manually: import duckdb
import duckdb_ext
with duckdb.connect() as con:
con.execute("SET extension_directory = ?;", (duckdb_ext.get_extension_dir(),))
# Ideally also:
con.execute("SET autoinstall_known_extensions = false;") or with a helper function (that does the same thing) import duckdb
import duckdb_ext
with duckdb_ext.init(duckdb.connect()) as con:
... Then you can either rely on extension autoloading or explicitly load extensions |
Beta Was this translation helpful? Give feedback.
-
Just for the books, what I did as a workaround - and I would love to see that feature also - is Create a file
and a
In other words, I use duckdb to install the extensions in the current directory. In the main program I obviously set the extension_directory also as a first step also. |
Beta Was this translation helpful? Give feedback.
-
some more use cases duckdb/duckdb#19127 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why do you want this feature?
Problem:
In some scenarios, it is not allowed to download binaries at run time in production.
Proposed solution:
In python environments, I think it would make sense to include the extensions as
extras
where you can install them likepython -m pip install duckdb[httpfs]
for example.Was this solution considered and discarded? if so, can you explain why?
If there are not big constrains, we will be happy to help in the implementation of this feature.
Note: This suggestion only applies to python, but I guess similar approaches could be implemented for other languages.
Beta Was this translation helpful? Give feedback.
All reactions