The issue for me was that I was using a shebang that bypassed the pyenv: #!/usr/bin/python3
#!/usr/bin/python3
You should always use: #!/usr/bin/env python3
#!/usr/bin/env python3