Does Dash require a java wrapper to be deployed? What is the best way to do it?

I am trying to deploy my Dash app to heroku. I had a bunch of problems with downloading some of the packages so following advice online, I deleted the problematic packages from the requirements.txt file - one of which was python-javabridge. Nonetheless, heroku still tries to install python-javabridge, so I figured it must be a general requirement, which is fine except it is giving me a tonne of problems. Currently it is giving me a numpy import error that I’m trying to solve…
Has anyone had any similar java-related problems while trying to deploy their Dash app? What in your experience is the best way to deploy it then?
I have to say this is the first web app I am trying to deploy so apologies if anything is too obvious / unclear.
Thanks in advance for the help!

Hi @ISquared

If you have time, Danny wrote a book about that: :grinning:

1 Like

@Eduardo thanks, I was literally just reading through it!

Enjoy ISquared. Yes Eduardo is my PR agent :slight_smile:


I had a bunch of trouble with the requirements stuff too, but ended up sticking to pip as much as I could on my local machine. It sounds like your problem might be more low level in terms of Heroku. Happy to help if you want to provide a little more detail in your specific problem. Is it requirements.txt package or something more low level? Cause you absolutely can get Heroku running numpy, pandas, basically every package fine. For the record.



@dan_baker thanks for the great book on Heroku deployment, it was a good read :smiley:
Any help will be greatly appreciated, I’ve been trying on and off for almost a week to deploy this app… (as I do this as a hoby when I’m not doing my real job). I found out that python-javabridge is needed for python-bioformats, once I deleted that from requirements.txt, javabridge no longer wants to be installed, so problem solved.
Until the next problem, which is that it tries to download pywin32 (also not in the requirements file), which of course it can not, probably because the Heroku is on a Linux server. I think the error was that it can not find a version that satisfies the requirement pywin32… etc. Last night I deleted some more packages from requirement (which I suspect might have pywin32 as a dependency) but haven’t had the chance to check if they solved the problem. Does this mean it’s nearly impossible to deloy to Heroku if you use a Windows machine? :frowning:

It sounds like you are using a windows machine with Anaconda or something and have a tonne of stuff already preinstalled, and you’re trying to get it to work on Heroku, which is purely linux. I managed to do it, but I wasn’t using any windows specific packages, so I eventually got it all running.

A few options:

  1. Use a python VENV
    Go to python virtual environment (if you haven’t already) and ensure it’s a clean empty version of python to start with (as opposed to annaconda and having a tonne of packages already preinstalled), and just install the packages you need. Get that working, and then you may have a different requirements.txt and Heroku might be easier to fault find.

  2. Go to WSL and develop in Linux

My best recommendation if you are having problems like that, is to go to a linux dev environment. This will ensure what you get on your local machine will also work with Heroku. Assuming that you CAN get the packages on linux then the best way to do this on a windows dev machine is with windows subsystem for linux. Follow the microsoft guide, and then you can install Unbuntu (free) from the microsoft store. Then you can do all dev in linux. VS code also has an extension that can directly connect to your WSL environment, so this means you can have VS code running on windows, connecting to your code which is actually residing on WSL with all the power of linux packages (and therefore similar to how Heroku manages packages).

I’d hope this might solve your problem, if I understand your problem correctly

Remote - WSL - Visual Studio Marketplace.

1 Like

Thanks so much for the extensive reply, much appreciated! I’m in Anaconda yes, in order to avoid all the dll errors I had in Python. :slight_smile: What you said made me realise I was making the mistake of running this in Spyder in Anaconda. I downloaded PyCharm, set my anaconda python.exe as the base interpreter, pip installed only the packages I need, now of course only the required packages were installed, which solved all my requirement.txt problems! (I still haven’t seen the app up and running since I encountered other problems now, but that’s for a different topic :stuck_out_tongue: )

It’s a very useful recommendation to develop in linux and also how to set it up - thanks! Would you say most servers work in Linux?

No worries!

Yeh, it’s a bit of a trap working with Annaconda, because it comes preinstalled with so many packages, so it’s misleading and you only need to add stuff to requirements that ARE NOT already installed by default, so in fact your requirements.txt is missing many packages. This is clearly why Heroku was not happy.

Sounds like fresh Python install with Pycharm then allowed you to identify exactly the packages you need. Once you get this running on your local machine with an accurate requirements.txt, Heroku should be ok.

Regarding developing linux, as long as you are careful about managing requirements.txt, there is no reason you can’t keep developing on windows with Annaconda/Pycharm/VS code. Going to WSL means you are actually developing on a real linux kernal, which just means getting some packages is easier (e.g. geopandas) and it’s generally better. But not essential.

For the record, all the PaaS services like Heroku etc, are basically running linux or unix. When you get a Dyno spun up on Heroku to host your page, this is actually a linux process that has special access to the underlying machine’s CPU, ram and storage. This way Heroku can have 1000’s of dynos sharing limited physical hardware underneith.

1 Like