briefcase
briefcase copied to clipboard
app_packages in the app bundle is not declared among the site packages
Describe the bug The app_packages directory in the app bundle is not including among the site packages. I've found this prevents TensorFlow from loading its plugins, but I wonder if that may not induce bugs in other situations.
To Reproduce
- Create an app with the code:
import logging
import site
import sys
logger = logging.getLogger('cookadream')
logger.setLevel(logging.INFO)
logger.addHandler(logging.FileHandler('/tmp/debug123.log'))
logger.info('sys.path = %s', sys.path)
logger.info('site.ENABLE_USER_SITE = %s', site.ENABLE_USER_SITE)
logger.info('site.USER_SITE = %s', site.USER_SITE)
logger.info('site.getsitepackages = %s', site.getsitepackages())
logger.info('site.getusersitepackages = %s', site.getusersitepackages())
- Build and run the app with briefcase, check the contents of the file /tmp/debug123.log
- app_packages appears in sys.path, but nowhere among the site packages
Expected behavior Expected to see the bundle's app_packages both in the sys.path and somewhere among the site packages.
Environment:
- Operating System: macOS 11.6.2
- Python version: 3.8.9
- Software versions:
- Briefcase: 0.3.5
Thanks for the report - that actually might explain some other odd behavior we've had reported, especially with packages that have extensive binary requirement (Qt is a common one).
We should definitely be making better use of, and integrating with, Python's user site handling. That might mean we need to simplify app
and app_packages
into a single folder, which we treat as the User site.