Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an uncaughtException: could not find a pipenv site-packages #7332

Closed
Ilpostuniversitario opened this issue May 14, 2021 · 4 comments
Closed
Assignees

Comments

@Ilpostuniversitario
Copy link

Meaningful / related issues:

Amplify's command

Push

Expected behavior

Expected the push to complete successfully

Steps to reproduce

  1. Pull an amplify project backend, with a function in python 3.8 pushed from a win10 pc
  2. Change layer or something in the code
  3. Push changes in amplify
  4. Execute pip install --user pipenv when amplify-push stops asking for it
  5. Push again

Relevant system info

Current OS

OS: Manjaro
Amplify CLI: v4.50.2 via npm
NPM: v6.14.13
Node: v14.17.0
Pyenv: v1.2.27
Python: v3.8.9

Previous OS

OS: Win10
Amplify CLI: v4.50.2 via npm
NPM: v6.14.8
Node: v12.18.2
Pyenv: N/A
Python: v3.8.3

Description

Hi, i'm trying to solve this, maybe you can help me.

I am starting to work on a linux distribution called manjaro.
I was previously working on windows without any problem (till now, but it's for another issue, though).

I already had a couple of functions in my amplify-project's backend, written in python.

I made a change to one of these function and amplify-pushed them.
Push operations gets an error, the one below, and i cannot understand why it is happening (i'm not enough into python right now to know about virtual environments, etc.)

I am looking for an explanation (to learn) and a solution.

#7188 looks similar, and it seems to have been successfully closed with #7254 fixing the bug.
Even thought i may have found the reasons causing my problem, i don't understand it, neither its solution.

Issue #6159, that's referenced by someone at #7032, seems to have some kind of precursor of my exception, there is a comment about doing pip install --user pipenv, which is a command amplify asked me to do (read reproduction step above).
After that a couple of people solved it changing version on pipfile. i have the "3.8" in it, and if i change it i fear of breaking my teammate's local settings. But as far as i know, AWS Lambda works with python 3.8, not 3.9 so idk if i should change it.

I'll appreciate your help troubleshooting this. Thanks for your time!

Amplify's sort of stacktrace

Error shown by amplify while pushing changes in python code (formatted by me to make it easier to read)
2021-05-13T19:02:28.800Z - error: uncaughtException: Could not find a pipenv site-packages directory at /home/user/.local/share/virtualenvs/myfunction-oQxBnkLp/lib/python3.9/site-packages 
  date=Thu May 13 2021 21:02:28 GMT+0200 (Ora legale dell’Europa centrale), 
  pid=3259, 
  uid=1000, 
  gid=1001, 
  cwd=/home/user/myproject, 
  execPath=/home/user/.nvm/versions/node/v14.17.0/bin/node, 
  version=v14.17.0, 
  argv=[
    /home/user/.nvm/versions/node/v14.17.0/bin/node, 
    /home/user/.nvm/versions/node/v14.17.0/bin/amplify, 
    push
  ], 
  rss=462733312, 
  heapTotal=311590912, 
  heapUsed=255198040, 
  external=20592039, 
  arrayBuffers=18435530, 
  loadavg=[6.3, 3.23, 2.09], 
  uptime=2762.64, 
  trace=[
    column=9, 
    file=/home/user/.nvm/versions/node/v14.17.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-python-function-runtime-provider/src/util/pyUtils.ts, 
    function=Object.getPipenvDir, 
    line=24, 
    method=getPipenvDir, 
    native=false, 
    column=null, 
    file=null, 
    function=runMicrotasks, 
    line=null, 
    method=null, 
    native=false, 
    column=5, 
    file=internal/process/task_queues.js, 
    function=processTicksAndRejections, 
    line=95, 
    method=null, 
    native=false, 
    column=21, 
    file=/home/user/.nvm/versions/node/v14.17.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-python-function-runtime-provider/src/util/packageUtils.ts, 
    function=null, 
    line=27, 
    method=null, 
    native=false
  ], 
  stack=[
    Error: Could not find a pipenv site-packages directory at /home/user/.local/share/virtualenvs/myfunction-oQxBnkLp/lib/python3.9/site-packages,     
    at Object.getPipenvDir (/home/user/.nvm/versions/node/v14.17.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-python-function-runtime-provider/src/util/pyUtils.ts:24:9),     
    at runMicrotasks (<anonymous>),     
    at processTicksAndRejections (internal/process/task_queues.js:95:5),    
    at /home/user/.nvm/versions/node/v14.17.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-python-function-runtime-provider/src/util/packageUtils.ts:27:21
  ]
@cjihrig
Copy link
Contributor

cjihrig commented May 14, 2021

Can you please try with v4.51.0 of the CLI, which was just released.

@Ilpostuniversitario
Copy link
Author

I updated to 4.51.0 and then tried again with 4.51.1

It seems to work just fine now, thanks.

Do you know what was wrong? I'd read the changelog myself but i'm still not good enough..

Anyway thank you i can now upload amplify with python changes

@cjihrig
Copy link
Contributor

cjihrig commented May 19, 2021

Glad to see that you're unblocked. I believe this issue was resolved by #7254.

Since this appears to be resolved, I'll close the issue out.

@cjihrig cjihrig closed this as completed May 19, 2021
@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants