Dependencies in Python Algos

Both Java and Rust algos allow external dependencies pulled from Gradle or, respectively. But Python algos don’t, which is especially detrimental to anyone trying machine learning. Can we allow python algos to have pip dependencies?

EDIT: Janis has an interesting workaround here, but it would be better to have an actual way to do this.

1 Like

Wait. Did @16daystocode use Java/Rust instead of Python to make it work with external files? Talking about the earlier post:

Nope. Just Python and the requests module.

So as far as I can see @C1Ryan already pointed network requests will get disabled (including Java and Rust I assume).
This kind of closes the thread doesn’t it?

Can we provide a requirements.txt ?

@C1Ryan, can you work on this?

Is this an issue locally as well? For whatever reason my local matches are throwing include errors on keras and tensorflow, but numpy imports fine. I tried using the 16day’s workaround but it throws “’_NamespacePath’ object has no attribute ‘sort’” and I can’t seem to work through the “fixes” for that.

Edit: I’m a dummy and installed everything on python2.7. Can’t figure out how to install anything for python3 because of the above error though… but this appears to be very much on my end.

Update: I got things to start working locally, but for those curious here’s the (likely) issue and the corresponding fixes. I’m running a WSL version of Ubuntu, which probably caused everything to break down, and discovered that this fix doesn’t work because the python3.5/dist-packages folder is empty. This makes ‘python3 -m pip install [package]’ throw a hissy fit, but as a workaround you can fix pip3 (one more fix for good measure) and install your dependencies using ‘pip3 install [package]’. This is probably a very specific issue caused by a mess I made, but I figured nobody should have to go through that on the off chance they share the same issues…

Its on the backlog, but is fairly low priority since we have a few other features in the works, and I feel like it will only have a minor benefit a relatively small number of users, especially since there is a workaround in place.

If anyone is looking to upload with dependencies specifically to run a Keras model, I wrote a brief explanation of how to do that here. Instead of importing Keras, Tensorflow, and Numpy, you can use an existing Keras-to-C++ repo and plug that C++ model back into Python.

1 Like

Maybe you could just add the most important/popular libraries for machine learning as this would simplify the development of such algos a lot.

Man, I’m really torn here. Part of me is like NOOO! I put so much work into my original ML bots (mostly to get versions that could run networks). However, a greater part of me supports this wholeheartedly because it will both make my life easier (all about the selfishness here :smile:) and make ML a viable option for more players, which is awesome.

1 Like

Has there been anyway to use numpy or scipy? calculating shortest distance pathfinding iteratively in python would be really slow, sounds like a few people have figured out how to connect to their own c++ code hmm

This algo looks like it may be useful: