https://pulumi.com logo
#general
Title
# general
r

rough-analyst-22850

01/24/2023, 6:10 AM
Hello all, Newbie to pulumi. Created a virtual env with python and installed all the dependencies. with pip , I am getting below error while doing pulumi up. I can import the module with import azureread directly from ipython in the same env. However Pulumi throws error. Any help would be appreciated.
Copy code
pulumi up --debug                                 │   12 ▏ ▏ subnets: [{
Previewing update (aks-prod)                                                                               │   13 ▏ ▏ ▏ ▏ name: "default",
                                                                                                           │   14 ▏ ▏ ▏ ▏ addressPrefix: "10.0.1.0/24",
View Live: ****                                                                                                        │   16 });
                                                                                                           │   17
     Type                 Name                    Plan       Info                                          │   18 // Create a subnet for AKS
 +   pulumi:pulumi:Stack  transcode-aks-aks-prod  create     1 error; 16 debugs                            │   19 const aksSubnet = new azure.network.Subnet("my-aks-subnet", {
                                                                                                           │   20 ▏ ▏ resourceGroupName: resourceGroup.name,
                                                                                                           │   21 ▏ ▏ virtualNetworkName: vnet.name,
Diagnostics:                                                                                               │  22 ▏ ▏ addressPrefix: "10.0.2.0/24",     ■ Argument of type '{ resourceGroupName: pulumi.Output<string>
  pulumi:pulumi:Stack (transcode-aks-aks-prod):                                                            │   23 });
    debug: registering resource: ty=pulumi:pulumi:Stack, name=transcode-aks-aks-prod, custom=False, remote=│   24
False                                                                                                      │   25 // Create an AKS cluster
    debug: Waiting for outstanding RPCs to complete                                                        │   26 const aksCluster = new azure.containerservice.KubernetesCluster("some-prod-aks", {
    debug: RPCs successfully completed                                                                     │   27 ▏ ▏ resourceGroupName: resourceGroup.name,
    debug: Waiting for 3 outstanding tasks to complete                                                     │   28 ▏ ▏ kubernetesVersion: "1.24.6",
    debug: beginning rpc register resource                                                                 │   29 ▏ ▏ dnsPrefix: "some-prod-aks-dns",
    debug: beginning rpc register resource outputs                                                         │  30 ▏ ▏ serviceCidr: "10.77.0.0/19",     ■ Argument of type '{ resourceGroupName: pulumi.Output<string>;
    debug: resource registration prepared: ty=pulumi:pulumi:Stack, name=transcode-aks-aks-prod             │   31 ▏ ▏ dnsServiceIp: "10.77.0.10",
    debug: resource registration successful: ty=pulumi:pulumi:Stack, urn=urn:pulumi:aks-prod::transcode-aks│   32 ▏ ▏ podCidr: "10.70.104.0/21",
::pulumi:pulumi:Stack::transcode-aks-aks-prod                                                              │   33 ▏ ▏ networkPlugin: "azure",
    debug: register resource outputs prepared: urn=urn:pulumi:aks-prod::transcode-aks::pulumi:pulumi:Stack:│   34 ▏ ▏ servicePrincipal: {
:transcode-aks-aks-prod, props=                                                                            │   35 ▏ ▏ ▏ ▏ clientId: "clientId",
    debug: resource registration successful: urn=urn:pulumi:aks-prod::transcode-aks::pulumi:pulumi:Stack::t│   36 ▏ ▏ ▏ ▏ clientSecret: "clientSecret",
ranscode-aks-aks-prod, props=                                                                              │   37 ▏ ▏ },
    debug: All outstanding tasks completed.                                                                │   38 ▏ ▏ roleBasedAccessControl: {
    debug: waiting for quiescence; 2 RPCs outstanding                                                      │   39 ▏ ▏ ▏ ▏ enabled: true,
    debug: waiting for quiescence; 1 RPCs outstanding                                                      │   40 ▏ ▏ },
    debug: RPCs successfully completed                                                                     │   41 ▏ ▏ linuxProfile: {
    debug: No outstanding tasks to complete                                                                │   42 ▏ ▏ ▏ ▏ adminUsername: "azureuser",
    debug: run_pulumi_func completed                                                                       │   43 ▏ ▏ ▏ ▏ sshKey: {
    error: Program failed with an unhandled exception:                                                     │   44 ▏ ▏ ▏ ▏ ▏ ▏ keyData: "ssh-rsa AAAAB...",
    Traceback (most recent call last):                                                                     │   45 ▏ ▏ ▏ ▏ },
      File "/Users/manjunath.kp/transcode-aks/./__main__.py", line 5, in <module>                          │   46 ▏ ▏ },
        import pulumi_azuread as azuread                                                                   │   47 ▏ ▏ agentPoolProfiles: [{
    ModuleNotFoundError: No module named 'pulumi_azuread'
Within same env This works perfectly fine
Copy code
(pyenv)  manjunath.kp@VER-BLR-LT2761  ~/transcode-aks  python
Python 3.10.9 (main, Dec 15 2022, 17:11:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulumi_azuread as azuread
>>>
e

echoing-dinner-19531

01/24/2023, 9:28 AM
Are you sure the environment is activated before calling into pulumi? The engine doesn't automatically use venvs.
c

creamy-agency-52831

01/24/2023, 1:33 PM
There is a
virtualenv
parameter which can be set in
Pulumi.yaml
under
runtime.options
. Ensure that points to your venv directory and you should be all set 🙂
r

rough-analyst-22850

01/24/2023, 3:47 PM
@echoing-dinner-19531 Absolutely yes. Made sure multiple times. Even pulumi module outside the pyenv isnt installed. But that loads up fine. Only this module is giving error.
Copy code
manjunath.kp@VER-BLR-LT2761  ~/transcode-manifests  python3
Python 3.10.9 (main, Dec 15 2022, 17:11:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulumi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pulumi'
>>>
 manjunath.kp@VER-BLR-LT2761  ~/transcode-manifests  source ~/pyenv/bin/activate
(pyenv)  manjunath.kp@VER-BLR-LT2761  ~/transcode-manifests  python3
Python 3.10.9 (main, Dec 15 2022, 17:11:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulumi
>>>
@creamy-agency-52831 Thanks, let me try that and get back to you.
Copy code
name: transcode-aks
runtime:
  name: python
  options:
    virtualenv: venv
description: A minimal Azure Native Python Pulumi program
@creamy-agency-52831 Specified, still the same issue.
c

creamy-agency-52831

01/25/2023, 12:16 AM
The `Pulumi.yaml`described above points to a local directory, but the venv you mentioned previously lives in
~/pyenv
r

rough-analyst-22850

01/25/2023, 12:59 AM
@creamy-agency-52831 Still the same.
Copy code
cat Pulumi.yaml
name: transcode-aks
runtime:
  name: python
  options:
    virtualenv: ~/pyenv
description: A minimal Azure Native Python Pulumi program
Copy code
pulumi up
Previewing update (aks-prod)

View Live: 
     Type                 Name                    Plan       Info
 +   pulumi:pulumi:Stack  transcode-aks-aks-prod  create     1 error


Diagnostics:
  pulumi:pulumi:Stack (transcode-aks-aks-prod):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/manjunath.kp/transcode-aks/./__main__.py", line 5, in <module>
        import pulumi_azuread as azuread
    ModuleNotFoundError: No module named 'pulumi_azuread'


(pyenv)  ✘ manjunath.kp@VER-BLR-LT2761  ~/transcode-aks  pip3 install pulumi_azuread
Requirement already satisfied: pulumi_azuread in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (5.34.0)
Requirement already satisfied: pulumi<4.0.0,>=3.0.0 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi_azuread) (3.52.1)
Requirement already satisfied: semver>=2.8.1 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi_azuread) (2.13.0)
Requirement already satisfied: parver>=0.2.1 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi_azuread) (0.4)
Requirement already satisfied: attrs>=19.2 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from parver>=0.2.1->pulumi_azuread) (22.1.0)
Requirement already satisfied: arpeggio>=1.7 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from parver>=0.2.1->pulumi_azuread) (2.0.0)
Requirement already satisfied: six~=1.12 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi<4.0.0,>=3.0.0->pulumi_azuread) (1.16.0)
Requirement already satisfied: grpcio==1.50 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi<4.0.0,>=3.0.0->pulumi_azuread) (1.50.0)
Requirement already satisfied: dill~=0.3 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi<4.0.0,>=3.0.0->pulumi_azuread) (0.3.6)
Requirement already satisfied: pyyaml~=6.0 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi<4.0.0,>=3.0.0->pulumi_azuread) (6.0)
Requirement already satisfied: protobuf~=4.21 in /Users/manjunath.kp/pyenv/lib/python3.10/site-packages (from pulumi<4.0.0,>=3.0.0->pulumi_azuread) (4.21.12)
(pyenv)  manjunath.kp@VER-BLR-LT2761  ~/transcode-aks  cat py
@creamy-agency-52831 Strange, I deactivated venv and installed dependencies on the OSX default pip and it is working fine now without venv.
For now, I am good. Thank you for your time.
2 Views