briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

app_packages in the app bundle is not declared among the site packages

Open dreavjr opened this issue 3 years ago • 1 comments

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

  1. 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())
  1. Build and run the app with briefcase, check the contents of the file /tmp/debug123.log
  2. 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

dreavjr avatar Feb 15 '22 01:02 dreavjr

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.

freakboy3742 avatar Feb 15 '22 01:02 freakboy3742