02/20/2020, 7:40 PM
hi all, trying out pulumi/python/azure and it doesn't work šŸ˜® probably a stupid beginner mistake. pulumi installed, logged into azure, created a pulumi project, created a virtualenv and installed requirements. pulumi up fails to import pulumi according the output. But if i start python i can import the module.


02/20/2020, 7:47 PM
Did you activate the virtual env with the install requirements? Also what steps did you create the project? (whats in the requirements.txt file?)


02/20/2020, 8:56 PM
yes the virtual env is activated
pulumi new azure-project --force (starts in a checked out git repos)
requirements.txt have the following lines pulumi>=1.0.0 pulumi-azure>=1.0.0
i am a little bit stumped as the same shell (with same virtualenv) imports the pulumi lib just fine from an interactive python prompt. (i'm running fish shell, could this confuse pulumi?)


02/20/2020, 9:05 PM
hmm maybe the shell, or maybe the version of python. I don't know I just saw you said might be a noob question wanted to make sure your bases were covered. here are the steps I tried to recreate it.
kev:/c/Users/Kev$ cd azure-check/
kev:/c/Users/Kev/azure-check$ pulumi new azure-python

This command will walk you through creating a new Pulumi project.

Enter a value or leave blank to accept the (default), and press <ENTER>.
Press ^C at any time to quit.

project name: (azure-check) project description: (A minimal Azure Python Pulumi program)
Created project 'azure-check'

Please enter your desired stack name.
To create a stack in an organization, use the format <org-name>/<stack-name> (e.g. `acmecorp/dev`).
stack name: (dev)
Created stack 'dev'

azure:environment: The Azure environment to use (`public`, `usgovernment`, `german`, `china`): (public)
azure:location: The Azure location to use: (WestUS)
Saved config

Your new project is ready to go!

To perform an initial deployment, run the following commands:

   1. virtualenv -p python3 venv
   2. source venv/bin/activate
   3. pip3 install -r requirements.txt

Then, run 'pulumi up'

kev:/c/Users/Kev/azure-check$ virtualenv -p python3 venv
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /c/Users/Kev/azure-check/venv/bin/python3
Also creating executable in /c/Users/Kev/azure-check/venv/bin/python
Installing setuptools, pip, wheel...
kev:/c/Users/Kev/azure-check$ source venv/bin/activate
(venv) kev:/c/Users/Kev/azure-check$ pip3 install -r requirements.txt                                   Collecting pulumi>=1.0.0
  Downloading pulumi-1.11.0-py2.py3-none-any.whl (90 kB)
     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 90 kB 2.6 MB/s
Collecting pulumi-azure>=1.0.0
  Downloading pulumi_azure-1.14.0.tar.gz (424 kB)
     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 424 kB 32.1 MB/s
Processing /home/kev/.cache/pip/wheels/59/b1/91/f02e76c732915c4015ab4010f3015469866c1eb9b14058d8e7/dill-
Collecting grpcio>=1.9.1
  Downloading grpcio-1.27.2-cp36-cp36m-manylinux2010_x86_64.whl (2.7 MB)
     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 2.7 MB 34.3 MB/s
Collecting protobuf>=3.6.0
  Using cached protobuf-3.11.3-cp36-cp36m-manylinux1_x86_64.whl (1.3 MB)
Collecting parver>=0.2.1
  Using cached parver-0.2.1-py3-none-any.whl (13 kB)
Collecting semver>=2.8.1
  Downloading semver-2.9.1-py2.py3-none-any.whl (9.8 kB)
Collecting six>=1.5.2
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: setuptools in ./venv/lib/python3.6/site-packages (from protobuf>=3.6.0->pulumi>=1.0.0->-r requirements.txt (line 1)) (45.2.0)
Collecting attrs>=17.4.0
  Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting arpeggio~=1.7
  Using cached Arpeggio-1.9.2-py2.py3-none-any.whl (57 kB)
Building wheels for collected packages: pulumi-azure
  Building wheel for pulumi-azure ( ... done
  Created wheel for pulumi-azure: filename=pulumi_azure-1.14.0-py3-none-any.whl size=1119692 sha256=b86ccf282f46b1e4d1109323bfbda8d0c4a849482c8afb35c5c670fa11c95439
  Stored in directory: /home/kev/.cache/pip/wheels/ae/5d/ab/0722c4fe232382919c16d77019037e075d1c870919d1b88221
Successfully built pulumi-azure
Installing collected packages: dill, six, grpcio, protobuf, pulumi, attrs, arpeggio, parver, semver, pulumi-azure
Successfully installed arpeggio-1.9.2 attrs-19.3.0 dill- grpcio-1.27.2 parver-0.2.1 protobuf-3.11.3 pulumi-1.11.0 pulumi-azure-1.14.0 semver-2.9.1 six-1.14.0
(venv) kev:/c/Users/Kev/azure-check$ pulumi up
Previewing update (dev):

     Type                         Name             Plan       Info
 +   pulumi:pulumi:Stack          azure-check-dev  create
     ā””ā”€ azure:core:ResourceGroup  resource_group              1 error
and its failing to import the pulumi module and not failing to load a plugin like this example
error: could not load plugin for aws provider
because I think the FAQ has something on that


02/20/2020, 9:29 PM
Running python 3.8.1 will try a 3.6.x and bash to see if that works


02/21/2020, 10:23 AM
3.8.1 works fine for me. You're on Windows or Linux?


02/21/2020, 12:16 PM
Linux (ubuntu 19.10) i am really confused as i can import the module fine when i launch the python shell from the same prompt.
@nice-baker-66367 yes it states it cannot find the pulumi module. I actuall became even more confused when i tried to set a breakpoint just before the import to be able to inspect the environment but while i see the (pdb) prompt it doesn't stop. i will revert to safe ground with bash to validate that it isn't my fish shell that is badly configured
so a bit more digging and it seems like pyenv and pulumi doesn't work together. for me it is easy to recreate by: ā€¢ install pyenv and pyenv-virtualenv ā€¢ create a pulumi project ā€¢ create a new pyenv-virtualenv ā€¢ run pyenv local [new venv] ā€¢ do pip install -r requirements ā€¢ pulumi exists in the active shell as you can import the pulumi module from a prompt ā€¢ run pulumi up and see it fail ā€¢ unless you have installed pulumi in the global python I have no idea (as of now) if this is a pulumi or pyenv problem. but fish as shell works fine at least