@andresrcs: First I want to say thanks for this post. Like the original post, I tried many solutions and spent hours researching how to get reticulate to work when publishing my app to shinyapps.io. Your post was very straightforward and I think finally made it click. I followed your suggestion and included similar code inside the app file. It seemed to work because I no longer get the error "Did you forget to set the RETICULATE_PYTHON environment variable in your .Rprofile before publishing?". However, I now get a different error. In the log output below it shows that the virtual environment is being created, and pandas and numpy are being installed successfully, but when the call is made to import pandas, it returns an error saying there is no module pandas.
Do you have any thoughts on why this might be happening?
Thanks.
Log output:
Creating virtual environment 'DataGen_shiny_env' ...
Using python: python3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/shiny/.virtualenvs/DataGen_shiny_env/bin/python3
Also creating executable in /home/shiny/.virtualenvs/DataGen_shiny_env/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Requirement already up-to-date: pip in /home/shiny/.virtualenvs/DataGen_shiny_env/lib/python3.5/site-packages (20.1.1)
Requirement already up-to-date: wheel in /home/shiny/.virtualenvs/DataGen_shiny_env/lib/python3.5/site-packages (0.34.2)
Requirement already up-to-date: setuptools in /home/shiny/.virtualenvs/DataGen_shiny_env/lib/python3.5/site-packages (46.4.0)
Using virtual environment 'DataGen_shiny_env' ...
Collecting pandas
Downloading pandas-0.24.2-cp35-cp35m-manylinux1_x86_64.whl (10.0 MB)
Collecting numpy
Downloading numpy-1.18.4-cp35-cp35m-manylinux1_x86_64.whl (20.0 MB)
Collecting python-dateutil>=2.5.0
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting pytz>=2011k
Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
Requirement already satisfied, skipping upgrade: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.5.0->pandas) (1.10.0)
Installing collected packages: python-dateutil, pytz, numpy, pandas
Listening on ...
Successfully installed numpy-1.18.4 pandas-0.24.2 python-dateutil-2.8.1 pytz-2020.1
Warning: Error in py_call_impl: ImportError: No module named 'pandas'