Repository: PrefectHQ/prefect

Issue:
Could not find a version that matches marshmallow-oneofschema<3.0,>=2.0.0b2
```
$ python --version
Python 3.5.2
```

```
(prefect) user@xxxxxx:~/code/prefect$ pipenv install prefect
Installing prefect…
Collecting prefect
  Downloading https://files.pythonhosted.org/packages/c3/86/6599cd54083875df820e3f980a22788a3e23756d8878f3b0e31a61b74dfe/prefect-0.5.0-py3-none-any.whl (208kB)
Collecting marshmallow-oneofschema<3.0,>=2.0.0b2 (from prefect)
  Downloading https://files.pythonhosted.org/packages/d6/e4/9e95f3aeb376dd1e6ca65c72985e26d65e0124fe4d2d9623ad7d28fc1bc8/marshmallow_oneofschema-2.0.0b2-py2.py3-none-any.whl
Collecting python-dateutil<3.0,>2.7.3 (from prefect)
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
Collecting pendulum<3.0,>=2.0.4 (from prefect)
  Downloading https://files.pythonhosted.org/packages/95/37/91ea39046ea2523d72e0607a94e3ededd65f0d945ccb0e042f0aecd87dfc/pendulum-2.0.4-cp35-cp35m-manylinux1_x86_64.whl (139kB)
Collecting distributed<2.0,>=1.21.8 (from prefect)
  Downloading https://files.pythonhosted.org/packages/e7/52/08ead8f0968d42510630f307100307b481298696cb7de81d58f0cdf7f320/distributed-1.26.0-py2.py3-none-any.whl (506kB)
Collecting requests<3.0,>=2.20 (from prefect)
  Downloading https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl (57kB)
Collecting xxhash<2.0,>=1.2.0 (from prefect)
  Downloading https://files.pythonhosted.org/packages/5e/bc/dc4c2f71a85b2952097fcf9c45475c7919cfe94290928a3467070dbec495/xxhash-1.3.0-cp35-cp35m-manylinux1_x86_64.whl (46kB)
Collecting toml<1.0,>=0.9.4 (from prefect)
  Downloading https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Collecting docker<4.0,>=3.4.1 (from prefect)
  Downloading https://files.pythonhosted.org/packages/fb/d8/8242b8fb3bd3000274fbf5ac1a06cdba8a5ccbcf4e2a8c05f0ab37999fd8/docker-3.7.1-py2.py3-none-any.whl (134kB)
Collecting cryptography<3.0,>=2.2.2 (from prefect)
  Downloading https://files.pythonhosted.org/packages/5b/12/b0409a94dad366d98a8eee2a77678c7a73aafd8c0e4b835abea634ea3896/cryptography-2.6.1-cp34-abi3-manylinux1_x86_64.whl (2.3MB)
Collecting pytz>=2018.7 (from prefect)
  Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
Collecting mypy-extensions<0.5,>=0.4.0 (from prefect)
  Downloading https://files.pythonhosted.org/packages/4d/72/8d54e2b296631b9b14961d583e56e90d9d7fba8a240d5ce7f1113cc5e887/mypy_extensions-0.4.1-py2.py3-none-any.whl
Collecting cloudpickle<0.7,>=0.6.0 (from prefect)
  Downloading https://files.pythonhosted.org/packages/fc/87/7b7ef3038b4783911e3fdecb5c566e3a817ce3e890e164fc174c088edb1e/cloudpickle-0.6.1-py2.py3-none-any.whl
Collecting idna<2.8,>=2.5 (from prefect)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
Collecting marshmallow==3.0.0b19 (from prefect)
  Downloading https://files.pythonhosted.org/packages/60/00/4f792fdbb7f0f243ce7fdb729bee3a8afde968e4bfda8365d47a9367a787/marshmallow-3.0.0b19-py2.py3-none-any.whl (48kB)
Collecting mypy<0.700,>=0.600 (from prefect)
  Downloading https://files.pythonhosted.org/packages/88/11/8092fdd9cf4c507e6c799bf663e713a5418beb9fda422df810f72641224c/mypy-0.670-py3-none-any.whl (1.5MB)
Collecting dask<2.0,>=0.18 (from prefect)
  Downloading https://files.pythonhosted.org/packages/b9/bc/0d747625c18397ed548c7890bf984a40d931b9ebac236c570a07565b0cc8/dask-1.1.4-py2.py3-none-any.whl (704kB)
Collecting croniter<0.4,>=0.3 (from prefect)
  Downloading https://files.pythonhosted.org/packages/a9/c9/11182a2507798c661b04a7914739ea8ca73a738e6869a23742029f51bc1a/croniter-0.3.29-py2.py3-none-any.whl
Collecting typing<4.0,>=3.6.4 (from prefect)
  Downloading https://files.pythonhosted.org/packages/4a/bd/eee1157fc2d8514970b345d69cb9975dcd1e42cd7e61146ed841f6e68309/typing-3.6.6-py3-none-any.whl
Collecting typing-extensions<4.0,>=3.6.4 (from prefect)
  Downloading https://files.pythonhosted.org/packages/0f/62/c66e553258c37c33f9939abb2dd8d2481803d860ff68e635466f12aa7efa/typing_extensions-3.7.2-py3-none-any.whl
Collecting click<8.0,>=7.0 (from prefect)
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting pyyaml<4.3,>=3.13 (from prefect)
  Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)
Collecting six>=1.5 (from python-dateutil<3.0,>2.7.3->prefect)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting pytzdata>=2018.3 (from pendulum<3.0,>=2.0.4->prefect)
  Downloading https://files.pythonhosted.org/packages/89/02/a3a1cef5074c28157df63846d05aa893f007a92f6bafec0d61cae36bf69d/pytzdata-2018.9-py2.py3-none-any.whl (981kB)
Collecting toolz>=0.7.4 (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/14/d0/a73c15bbeda3d2e7b381a36afb0d9cd770a9f4adc5d1532691013ba881db/toolz-0.9.0.tar.gz (45kB)
Collecting zict>=0.1.3 (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/bd/45/a2e6f95a850cd407d785f2f8624b02e72baf6ab910aea4bdcac7e18b4871/zict-0.1.4-py2.py3-none-any.whl
Collecting sortedcontainers!=2.0.0,!=2.0.1 (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/13/f3/cf85f7c3a2dbd1a515d51e1f1676d971abe41bba6f4ab5443240d9a78e5b/sortedcontainers-2.1.0-py2.py3-none-any.whl
Collecting tornado>=5 (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/03/3f/5f89d99fca3c0100c8cede4f53f660b126d39e0d6a1e943e95cc3ed386fb/tornado-6.0.2.tar.gz (481kB)
Collecting tblib (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/4a/82/1b9fba6e93629a8557f9784cd8f1ae063c8762c26446367a6764edd328ce/tblib-1.3.2-py2.py3-none-any.whl
Collecting msgpack (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/3d/44/4a8be4f56ab3c8fc58800c06b2d681d5622704746d094411f00e25300072/msgpack-0.6.1-cp35-cp35m-manylinux1_x86_64.whl (243kB)
Collecting psutil>=5.0 (from distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/2f/b8/11ec5006d2ec2998cb68349b8d1317c24c284cf918ecd6729739388e4c56/psutil-5.6.1.tar.gz (427kB)
Collecting certifi>=2017.4.17 (from requests<3.0,>=2.20->prefect)
  Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests<3.0,>=2.20->prefect)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting urllib3<1.25,>=1.21.1 (from requests<3.0,>=2.20->prefect)
  Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
Collecting docker-pycreds>=0.4.0 (from docker<4.0,>=3.4.1->prefect)
  Downloading https://files.pythonhosted.org/packages/f5/e8/f6bd1eee09314e7e6dee49cbe2c5e22314ccdb38db16c9fc72d2fa80d054/docker_pycreds-0.4.0-py2.py3-none-any.whl
Collecting websocket-client>=0.32.0 (from docker<4.0,>=3.4.1->prefect)
  Downloading https://files.pythonhosted.org/packages/29/19/44753eab1fdb50770ac69605527e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-none-any.whl (200kB)
Collecting cffi!=1.11.3,>=1.8 (from cryptography<3.0,>=2.2.2->prefect)
  Downloading https://files.pythonhosted.org/packages/5b/44/fdae2a8f66af426055f9b6fff0b155217081eddaf08a3df79ca11fe05bda/cffi-1.12.2-cp35-cp35m-manylinux1_x86_64.whl (428kB)
Collecting asn1crypto>=0.21.0 (from cryptography<3.0,>=2.2.2->prefect)
  Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
Collecting typed-ast<1.4.0,>=1.3.1 (from mypy<0.700,>=0.600->prefect)
  Downloading https://files.pythonhosted.org/packages/b1/62/7e0bfe7bb75bf8a41b58ccb7bd3ab3afaec61e06d9abfda113ad0dc227be/typed_ast-1.3.1-cp35-cp35m-manylinux1_x86_64.whl (734kB)
Collecting heapdict (from zict>=0.1.3->distributed<2.0,>=1.21.8->prefect)
  Downloading https://files.pythonhosted.org/packages/e2/ca/f5feba2f939c97629dbce52a17acc95a0d10256ef620334795379dda8ce6/HeapDict-1.0.0.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography<3.0,>=2.2.2->prefect)
  Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
Building wheels for collected packages: pyyaml, toolz, tornado, psutil, heapdict, pycparser
  Building wheel for pyyaml (setup.py): started
  Building wheel for pyyaml (setup.py): finished with status 'done'
  Stored in directory: /home/user/.cache/pipenv/wheels/ad/da/0c/74eb680767247273e2cf2723482cb9c924fe70af57c334513f
  Building wheel for toolz (setup.py): started
  Building wheel for toolz (setup.py): finished with status 'done'
  Stored in directory: /home/user/.cache/pipenv/wheels/f4/0c/f6/ce6b2d1aa459ee97cc3c0f82236302bd62d89c86c700219463
  Building wheel for tornado (setup.py): started
  Building wheel for tornado (setup.py): finished with status 'done'
  Stored in directory: /home/user/.cache/pipenv/wheels/61/7e/7a/5e02e60dc329aef32ecf70e0425319ee7e2198c3a7cf98b4a2
  Building wheel for psutil (setup.py): started
  Building wheel for psutil (setup.py): finished with status 'done'
  Stored in directory: /home/user/.cache/pipenv/wheels/86/36/f4/e1fc49f198c623b8dc2156e80011a52f19a959d538f6b1a5db
  Building wheel for heapdict (setup.py): started
  Building wheel for heapdict (setup.py): finished with status 'done'
  Stored in directory: /home/user/.cache/pipenv/wheels/40/b9/42/344857b482c954f48bcff6db72d388e30bf2bee4ed14706faa
  Building wheel for pycparser (setup.py): started
  Building wheel for pycparser (setup.py): finished with status 'done'
  Stored in directory: /home/user/.cache/pipenv/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511
Successfully built pyyaml toolz tornado psutil heapdict pycparser
Installing collected packages: marshmallow, marshmallow-oneofschema, six, python-dateutil, pytzdata, pendulum, toolz, pyyaml, heapdict, zict, dask, sortedcontainers, click, tornado, tblib, cloudpickle, msgpack, psutil, distributed, idna, certifi, chardet, urllib3, requests, xxhash, toml, docker-pycreds, websocket-client, docker, pycparser, cffi, asn1crypto, cryptography, pytz, mypy-extensions, typed-ast, mypy, croniter, typing, typing-extensions, prefect
Successfully installed asn1crypto-0.24.0 certifi-2019.3.9 cffi-1.12.2 chardet-3.0.4 click-7.0 cloudpickle-0.6.1 croniter-0.3.29 cryptography-2.6.1 dask-1.1.4 distributed-1.26.0 docker-3.7.1 docker-pycreds-0.4.0 heapdict-1.0.0 idna-2.7 marshmallow-3.0.0b19 marshmallow-oneofschema-2.0.0b2 msgpack-0.6.1 mypy-0.670 mypy-extensions-0.4.1 pendulum-2.0.4 prefect-0.5.0 psutil-5.6.1 pycparser-2.19 python-dateutil-2.8.0 pytz-2018.9 pytzdata-2018.9 pyyaml-3.13 requests-2.21.0 six-1.12.0 sortedcontainers-2.1.0 tblib-1.3.2 toml-0.10.0 toolz-0.9.0 tornado-6.0.2 typed-ast-1.3.1 typing-3.6.6 typing-extensions-3.7.2 urllib3-1.24.1 websocket-client-0.56.0 xxhash-1.3.0 zict-0.1.4

Adding prefect to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…

Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
Could not find a version that matches marshmallow-oneofschema<3.0,>=2.0.0b2
Tried: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.3, 1.0.4, 1.0.4, 1.0.5, 1.0.5
Skipped pre-versions: 2.0.0b1, 2.0.0b1, 2.0.0b2, 2.0.0b2
There are incompatible versions in the resolved dependencies.




Discussion:
Thanks for the issue @dazzag24 !

Interesting --> it appears that `pipenv` is ignoring pre-release versions.  Do you have
```
[pipenv]

allow_prereleases = true
```
set in your `Pipfile`? 
Thanks for the swift reply.  I added 

```
allow_prereleases = true
```

which resolved the install issue.  However it doesn't seem to have delivered a working setup as I can't run the simple Hello World example:

```
(prefect) $ python ./example.py 
Traceback (most recent call last):
  File "./example.py", line 1, in <module>
    from prefect import task, Flow
  File "/home/user/.virtualenvs/prefect-PyOE8qQA/lib/python3.5/site-packages/prefect/__init__.py", line 1, in <module>
    import prefect.utilities
  File "/home/user/.virtualenvs/prefect-PyOE8qQA/lib/python3.5/site-packages/prefect/utilities/__init__.py", line 8, in <module>
    import prefect.utilities.notifications
  File "/home/user/.virtualenvs/prefect-PyOE8qQA/lib/python3.5/site-packages/prefect/utilities/notifications.py", line 22, in <module>
    TrackedObjectType = Union["prefect.Flow", "prefect.Task"]
  File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "/usr/lib/python3.5/typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 190, in __subclasscheck__
    self._eval_type(globalns, localns)
  File "/usr/lib/python3.5/typing.py", line 177, in _eval_type
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
AttributeError: module 'prefect' has no attribute 'Task'


(prefect) $ more example.py 
from prefect import task, Flow

@task
def say_hello():
    print("Hello, world!")

with Flow("My First Flow") as flow:
    say_hello()

flow.run() # "Hello, world!"
````
Hmm so it _appears_ that some of our static typing code is being executed, which is suspicious.  I'll have to recreate this locally and get back to you before I have any further insights.
Thanks.  Let me know if you want me to test anything else.

@dazzag24 could you try running
```
pipenv run python example.py
```
instead?  I believe that `pipenv` doesn't adjust your PATH so `python` just calls your system python.
Hi,

Same behaviour I'm afraid.

 $ pipenv run python example.py 
Traceback (most recent call last):
  File "./example.py", line 1, in <module>
    from prefect import task, Flow
  File "/home/user/.virtualenvs/prefect-PyOE8qQA/lib/python3.5/site-packages/prefect/__init__.py", line 1, in <module>
    import prefect.utilities
  File "/home/user/.virtualenvs/prefect-PyOE8qQA/lib/python3.5/site-packages/prefect/utilities/__init__.py", line 8, in <module>
    import prefect.utilities.notifications
  File "/home/user/.virtualenvs/prefect-PyOE8qQA/lib/python3.5/site-packages/prefect/utilities/notifications.py", line 22, in <module>
    TrackedObjectType = Union["prefect.Flow", "prefect.Task"]
  File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "/usr/lib/python3.5/typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 190, in __subclasscheck__
    self._eval_type(globalns, localns)
  File "/usr/lib/python3.5/typing.py", line 177, in _eval_type
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
AttributeError: module 'prefect' has no attribute 'Task'



Thanks @dazzag24 this is interesting!  FWIW if you use python3.6 this error seems to go away.  I'm not sure why it's occurring in python 3.5.2 yet.

For anyone following along, I was able to recreate this via:
```
# in my own shell
docker run -it python:3.5.2 bash
```
and within the container:
```
# set up the environment
curl https://raw.githubusercontent.com/kennethreitz/pipenv/master/get-pipenv.py | python
mkdir pre-test && cd pre-test
pipenv install --pre prefect

# make the file
cat <<'EOF' >> example.py 
from prefect import task, Flow

@task
def say_hello():
    print("Hello, world!")

with Flow("My First Flow") as flow:
    say_hello()

flow.run() # "Hello, world!"
EOF

# execute it
pipenv run python example.py
```

And I get the exact same error.
@dazzag24 FYI it works if you use python 3.5.3 instead of python 3.5.2
Thanks.  I'll give a different Python version a go.  However I think 3.5.2
is the default on Ubuntu 16.04 LTS so you may want to add an obvious note
to the docs to prevent others hitting the same issue.

Thanks again
Darren

On Wed, 27 Mar 2019 at 20:30, Chris White <notifications@github.com> wrote:

> @dazzag24 <https://github.com/dazzag24> FYI it works if you use python
> 3.5.3 instead of python 3.5.2
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/PrefectHQ/prefect/issues/857#issuecomment-477335356>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABAcVz2Y1k4OSU9eRPBDXFysN9GjwNp4ks5va9TxgaJpZM4cMZwl>
> .
>

Update: this was apparently an actual bug in Python 3.5.2 that was fixed in 3.5.3: https://bugs.python.org/issue26477

There are workarounds that I'm exploring to see how easy it would be to fix this.

Resolving patch:
diff --git a/src/prefect/utilities/executors.py b/src/prefect/utilities/executors.py
--- a/src/prefect/utilities/executors.py
+++ b/src/prefect/utilities/executors.py
@@ -14,7 +14,8 @@
 if TYPE_CHECKING:
     import prefect.engine.runner
     import prefect.engine.state
-StateList = Union["prefect.engine.state.State", List["prefect.engine.state.State"]]
+    from prefect.engine.state import State
+StateList = Union["State", List["State"]]
 
 
 class Heartbeat(threading.Timer):
diff --git a/src/prefect/utilities/notifications.py b/src/prefect/utilities/notifications.py
--- a/src/prefect/utilities/notifications.py
+++ b/src/prefect/utilities/notifications.py
@@ -17,9 +17,10 @@
 if TYPE_CHECKING:
     import prefect.engine.state
     import prefect.client
+    from prefect import Flow, Task
 
 __all__ = ["callback_factory", "gmail_notifier", "slack_notifier"]
-TrackedObjectType = Union["prefect.Flow", "prefect.Task"]
+TrackedObjectType = Union["Flow", "Task"]
 
 
 def callback_factory(


Test patch: