COLLECT not respecting sys.path nor PYTHONPATH

34 views
Skip to first unread message

Higor

unread,
Jan 25, 2021, 9:07:18 AM1/25/21
to PyInstaller
For some reason pyinstaller insists on picking poetry's vendorized
version of jsonschema even though I'm removing poetry's entire _vendor
directory out of the search path.

I've added the following snippet at the top of my .spec file to remove
references to poetry's vendorized versions of some libraries:

    search_path = []
    for path in sys.path:
        path = str(pathlib.Path(path).resolve())
        if 'poetry\\core\\_vendor' not in path:
            search_path.append(path)

    sys.path = search_path
    os.environ["PYTHONPATH"] = os.pathsep.join(sys.path)

Later on I print out the path values as well as the directories of the
environments and as you can see there's no reference to poetry\core\_vendor:

    sys.path= ['C:\\Users\\heuri\\AppData\\Local\\Programs\\Python\\Python38\\Scripts\\pyinstaller.exe', 'C:\\Users\\heuri\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip', 'C:\\Users\\heuri\\AppData\\Local\\Programs\\Python\\Python38\\DLLs', 'C:\\Users\\heuri\\AppData\\Local\\Programs\\Python\\Python38\\Lib', 'C:\\Users\\heuri\\AppData\\Local\\Programs\\Python\\Python38', 'C:\\Users\\heuri\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages']
    PYTHONPATH= C:\Users\heuri\AppData\Local\Programs\Python\Python38\Scripts\pyinstaller.exe;C:\Users\heuri\AppData\Local\Programs\Python\Python38\python38.zip;C:\Users\heuri\AppData\Local\Programs\Python\Python38\DLLs;C:\Users\heuri\AppData\Local\Programs\Python\Python38\Lib;C:\Users\heuri\AppData\Local\Programs\Python\Python38;C:\Users\heuri\AppData\Local\Programs\Python\Python38\Lib\site-packages
    launcher's site-packages= C:\Users\heuri\AppData\Local\pypoetry\Cache\virtualenvs\REDACTED-launcher-MKijLxw9-py3.8\Lib\site-packages
    dashboard's site-packages= C:\Users\heuri\AppData\Local\pypoetry\Cache\virtualenvs\REDACTED-Mh8E0adn-py3.8\Lib\site-packages
 
Yet pyinstaller keeps picking _vendor\jsonschema at COLLECT and fails:

    Security-Alert: try to store file outside of dist-directory. Aborting. 'c:\\users\\heuri\\appdata\\local\\programs\\python\\python38\\lib\\site-packages\\poetry\\core\\_vendor\\jsonschema\\benchmarks\\__pycache__\\json_schema_test_suite.cpython-38.pyc'

I've added regular and pre_find_module_path (to filter out poetry paths)
hooks for jsonschema but they didn't change a thing.

What are my options?

bwoodsend

unread,
Jan 25, 2021, 3:07:35 PM1/25/21
to PyInstaller

Sounds like a bug. Can you share your xref file? It should be located in build\[project-name]\xref-[project-name].html.

Higor

unread,
Jan 26, 2021, 4:09:53 AM1/26/21
to PyInstaller

Higor

unread,
Feb 6, 2021, 7:35:07 AM2/6/21
to PyInstaller
Hi, it's been a while.

Any pointers on how I could investigate further?

Brenainn Woodsend

unread,
Feb 8, 2021, 2:22:15 PM2/8/21
to pyins...@googlegroups.com
Sorry, no the xref file didn't hold any answers I could see. I'm stumped.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/a3b3fb14-9157-4be8-aad7-ea43b5170e18n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages