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

RuntimeError: Cannot find module '@aws-cdk/cx-api' but it's installed #30088

Closed
UriZafrir opened this issue May 7, 2024 · 6 comments
Closed
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch bug This issue is a bug.

Comments

@UriZafrir
Copy link

Describe the bug

Hi
I'm using cdk 2.140.0 (build 46168aa) with python.
in my requirements i have
aws-cdk-lib==2.139.1
constructs>=10.0.0,<11.0.0

after
pip install -r requirements.txt

when i do
cdk synth

i get:

$ cdk synth
jsii.errors.JavaScriptError:
  Error: Cannot find module '@aws-cdk/cx-api'
  Require stack:
  - /tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/cfn-resource.js
  - /tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/tag-aspect.js
  - /tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/index.js
  - /tmp/jsii-kernel-rLzub6
      at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
      at Module._load (node:internal/modules/cjs/loader:984:27)
      at Module.require (node:internal/modules/cjs/loader:1231:19)
      at require (node:internal/modules/helpers:179:18)
      at Object.<anonymous> (/tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/cfn-resource.js:3:15)
      at Module._compile (node:internal/modules/cjs/loader:1369:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
      at Module.load (node:internal/modules/cjs/loader:1206:32)
      at Module._load (node:internal/modules/cjs/loader:1022:12)
      at Module.require (node:internal/modules/cjs/loader:1231:19)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/uri/general/python-cdk/app.py", line 4, in <module>
    import aws_cdk as cdk
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/aws_cdk/__init__.py", line 34089, in <module>
    from . import aws_apigateway
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/aws_cdk/aws_apigateway/__init__.py", line 1819, in <module>
    from ..aws_certificatemanager import ICertificate as _ICertificate_c194c70b
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/aws_cdk/aws_certificatemanager/__init__.py", line 250, in <module>
    from ..aws_cloudwatch import (
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/aws_cdk/aws_cloudwatch/__init__.py", line 12, in <module>
    import aws_cdk.aws_iam
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/aws_cdk/aws_iam/__init__.py", line 12, in <module>
    import aws_cdk.cdk
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/aws_cdk/cdk/__init__.py", line 13, in <module>
    __jsii_assembly__ = jsii.JSIIAssembly.load("@aws-cdk/cdk", "0.28.0", __name__, "cdk@0.28.0.jsii.tgz")
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/jsii/_runtime.py", line 55, in load
    _kernel.load(assembly.name, assembly.version, os.fspath(assembly_path))
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/jsii/_kernel/__init__.py", line 299, in load
    self.provider.load(LoadRequest(name=name, version=version, tarball=tarball))
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/jsii/_kernel/providers/process.py", line 354, in load
    return self._process.send(request, LoadResponse)
  File "/home/uri/general/python-cdk/.venv/lib/python3.10/site-packages/jsii/_kernel/providers/process.py", line 342, in send
    raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: Cannot find module '@aws-cdk/cx-api'
Require stack:
- /tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/cfn-resource.js
- /tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/tag-aspect.js
- /tmp/jsii-kernel-rLzub6/node_modules/@aws-cdk/cdk/lib/index.js
- /tmp/jsii-kernel-rLzub6

Subprocess exited with error 1

when i list my installed packages it's installed:

pip list
Package                           Version
--------------------------------- -----------
attrs                             23.2.0
aws-cdk.asset-awscli-v1           2.2.202
aws-cdk.asset-kubectl-v20         2.1.2
aws-cdk.asset-node-proxy-agent-v6 2.0.3
aws-cdk.aws-cloudwatch            0.28.0
aws-cdk.aws-iam                   0.28.0
aws-cdk.cdk                       0.28.0
aws-cdk.cx-api                    0.28.0
aws-cdk-lib                       2.139.1
aws-cdk.region-info               0.28.0
cattrs                            23.2.3
constructs                        10.3.0
exceptiongroup                    1.2.1
importlib_resources               6.4.0
jsii                              1.98.0
pip                               22.0.2
publication                       0.0.3
python-dateutil                   2.9.0.post0
setuptools                        59.6.0
six                               1.16.0
typeguard                         2.13.3
typing_extensions                 4.11.0

Expected Behavior

should work

Current Behavior

not working

Reproduction Steps

in my requirements.txt i have
aws-cdk-lib==2.139.1
constructs>=10.0.0,<11.0.0

after
pip install -r requirements.txt

do
cdk synth

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.140.0 (build 46168aa)

Framework Version

No response

Node.js Version

v20.12.2

OS

windows 10

Language

Python

Language Version

No response

Other information

No response

@UriZafrir UriZafrir added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 7, 2024
@github-actions github-actions bot added the @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch label May 7, 2024
@AlexGurtoff
Copy link
Contributor

It is a duplicate of #30067

@ashishdhingra
Copy link
Contributor

@UriZafrir Could you please share the sample code to reproduce the issue? OR, kindly confirm if your scenario same as mentioned in the issue #30067 per previous comment by @AlexGurtoff.

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels May 7, 2024
Copy link

github-actions bot commented May 9, 2024

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 9, 2024
@UriZafrir
Copy link
Author

Hi, I think this is irrelevant, problem solved.
I had a package that caused this. I deleted the virtual environment and it was solved.
Sorry for the hassle.
best regards

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels May 10, 2024
@ashishdhingra ashishdhingra closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants