Installation issues

I’ve been unable to install prefect. I tried with prefect 1.0 couple of months ago, and I was hoping 2.0 would fix the issue, but even that one does not seem to work…

conda create -n prefect python=3.8
conda install prefect

I did not start the agent, not sure if that is required for local run.
I just try to import prefect and I get this error message:

(prefect) **PS>python**
Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:59:00) [MSC v.1929 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

**>>> import prefect**

> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\__init__.py", line 26, in <module>
>     from prefect.flows import flow, Flow
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\flows.py", line 36, in <module>
>     from prefect.context import PrefectObjectRegistry, registry_from_script
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\context.py", line 33, in <module>
>     from prefect.client import OrionClient
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\client.py", line 55, in <module>
>     from prefect.orion.api.server import ORION_API_VERSION, create_app
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\api\__init__.py", line 1, in <module>
>     from . import (
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\api\admin.py", line 9, in <module>
>     import prefect.orion.api.dependencies as dependencies
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\api\dependencies.py", line 10, in <module>
>     from prefect.orion.database.dependencies import provide_database_interface
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\database\dependencies.py", line 14, in <module>
>     from prefect.orion.database.interface import OrionDBInterface
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\database\interface.py", line 7, in <module>
>     from prefect.orion.database.orm_models import BaseORMConfiguration
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\database\orm_models.py", line 26, in <module>
>     from prefect.orion.utilities.encryption import decrypt_fernet, encrypt_fernet
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\prefect\orion\utilities\encryption.py", line 7, in <module>
>     from cryptography.fernet import Fernet
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\cryptography\fernet.py", line 16, in <module>
>     from cryptography.hazmat.primitives.hmac import HMAC
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\cryptography\hazmat\primitives\hmac.py", line 12, in <module>
>     from cryptography.hazmat.backends.openssl.hmac import _HMACContext
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\cryptography\hazmat\backends\openssl\__init__.py", line 6, in <module>
>     from cryptography.hazmat.backends.openssl.backend import backend
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 63, in <module>
>     from cryptography.hazmat.bindings.openssl import binding
>   File "C:\ProgramData\Anaconda3\envs\prefect\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 14, in <module>
>     from cryptography.hazmat.bindings._openssl import ffi, lib
> ImportError: DLL load failed while importing _openssl: The specified module could not be found.

Some modules installed:

...
cryptography              37.0.1           py38h21b164f_0
dataclasses               0.8                pyhc8e2a94_3    conda-forge
docker-py                 5.0.3            py38haa244fe_2    conda-forge
docker-pycreds            0.4.0                      py_0    conda-forge
fastapi                   0.79.0             pyhd8ed1ab_0    conda-forge
frozenlist                1.3.1            py38h294d835_0    conda-forge
fsspec                    2022.7.1           pyhd8ed1ab_0    conda-forge
future                    0.18.2           py38haa244fe_5    conda-forge
google-auth               2.10.0             pyh6c4a22f_0    conda-forge
greenlet                  1.1.2            py38h885f38d_2    conda-forge
griffe                    0.21.0           py38haa244fe_0    conda-forge
h11                       0.12.0             pyhd8ed1ab_0    conda-forge
h2                        4.1.0            py38haa244fe_0    conda-forge
hpack                     4.0.0              pyh9f0ad1d_0    conda-forge
httpcore                  0.15.0             pyhd8ed1ab_0    conda-forge
httpx                     0.23.0           py38haa244fe_0    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.4           py38haa244fe_0    conda-forge
importlib_metadata        4.11.4               hd8ed1ab_0    conda-forge
importlib_resources       5.9.0              pyhd8ed1ab_0    conda-forge
jsonpatch                 1.32               pyhd8ed1ab_0    conda-forge
jsonpointer               2.0                        py_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libzlib                   1.2.12               h8ffe710_2    conda-forge
mako                      1.2.1              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.1            py38h294d835_1    conda-forge
multidict                 6.0.2            py38h294d835_1    conda-forge
oauthlib                  3.2.0              pyhd8ed1ab_0    conda-forge
openssl                   3.0.5                h8ffe710_1    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pendulum                  2.1.2            py38h294d835_4    conda-forge
prefect                   2.0.3              pyhd8ed1ab_0    conda-forge
...
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1            py38haa244fe_5    conda-forge
python                    3.8.13          hcf16a7b_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-kubernetes         24.2.0             pyhd8ed1ab_0    conda-forge
python-slugify            6.1.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytz                      2022.1             pyhd8ed1ab_0    conda-forge
pytzdata                  2020.1             pyh9f0ad1d_0    conda-forge
pyu2f                     0.1.5              pyhd8ed1ab_0    conda-forge
pywin32                   303              py38h294d835_0    conda-forge
pyyaml                    6.0              py38h294d835_4    conda-forge
readchar                  3.1.0                    pypi_0    pypi
requests                  2.28.1             pyhd8ed1ab_0    conda-forge
...

It looks like it doesn’t work for you when you try to do that on Powershell - did you try e.g. using WSL or even running Prefect in a docker container?

Example (if you’re on and, you can leave out the platform):

docker run --platform linux/amd64 -ti -p 4200:4200 --expose=4200 prefecthq/prefect:2.0.1-python3.9

I’m not allowed to use docker nor WSL on this machine. We managed to install it on several windows machines in AWS etc, but for some reason on couple of non AWS machines, it just does not want to be installed. As you can see it is complaining about some odd module in prefect 2 (above) and in prefect 1 it complains about bitbucket submodule of prefect, see below.
Could it be that there is some kind of firewall rules that are causing the issue?

This is the error when attempting to use prefect 1+ in python 3.7 running inside cygwin, but similar issue happens in PS and CMD.

$ python --version                                                                                                                                                                                
Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import prefect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\__init__.py", line 9, in <module>
    import prefect.triggers
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\triggers.py", line 48, in <module>
    from prefect.engine import signals
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\engine\__init__.py", line 7, in <module>
    from prefect.engine.flow_runner import FlowRunner
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\engine\flow_runner.py", line 15, in <module>
    from prefect.core import Edge, Flow, Task
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\core\__init__.py", line 4, in <module>
    from prefect.core.flow import Flow
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\core\flow.py", line 43, in <module>
    from prefect.storage import Storage, get_default_storage_class
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\storage\__init__.py", line 13, in <module>
    from prefect.storage.bitbucket import Bitbucket
  File "C:\ProgramData\Anaconda3\envs\ml37\lib\site-packages\prefect\storage\bitbucket.py", line 22, in <module>
    allowed_methods=["HEAD", "GET", "OPTIONS"],  # type: ignore
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'

Gotcha. Developing on Windows is tough, do you have a chance to get a Cloud IDE like Amazon Cloud 9 or GitHub Codespaced or Replit? Might be easier

Could your developers look at the original error message? I’m sure there is some explanation what the problem is. My preference is to work on prefect 2, you can ignore prefect 1 error message.

I set up as much as I can on AWS etc, but this one I can not.
The issue is that I need to use this Windows environment as that one has a file system that I can not access from anywhere and there are some apps that need to run on this machine due to licensing restrictions.

Yup, makes sense. I can’t dive deeper since I have no access to a Windows machine but I asked a colleague to QA things on Windows a bit more, if we find something, we’ll definitely release a fix for it as soon as possible

sorry that I can’t help more but I can’t reproduce on Linux and Mac

Hopefully this helps your developers. prefect works under python 3.9, but not under 3.7 and 3.8.