question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] TypeError: cannot create 'cython_function_or_method' instances

See original GitHub issue

Describe the bug

tests/test_server.py:10: in <module>
    from j2db.server import Server
j2db/server.py:1: in <module>
    from fastapi import FastAPI
/opt/hostedtoolcache/Python/3.7.4/x64/lib/python3.7/site-packages/fastapi/__init__.py:7: in <module>
    from .applications import FastAPI
/opt/hostedtoolcache/Python/3.7.4/x64/lib/python3.7/site-packages/fastapi/applications.py:3: in <module>
    from fastapi import routing
/opt/hostedtoolcache/Python/3.7.4/x64/lib/python3.7/site-packages/fastapi/routing.py:6: in <module>
    from fastapi import params
/opt/hostedtoolcache/Python/3.7.4/x64/lib/python3.7/site-packages/fastapi/params.py:14: in <module>
    class Param(Schema):
E   TypeError: cannot create 'cython_function_or_method' instances

To Reproduce

hmm … i don’t know why. It suddenly happened in github actions and did not happen before.

Environment:

  • Linux
  • fastapi-0.42.0
  • python 3.7.4

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Toumetiscommented, Oct 24, 2019

pydantic 1.0.0 has been released, with breaking changes. In particular, Field and Schema are now functions rather than classes & cannot be subclassed.

0reactions
lcsvcncommented, Apr 10, 2022

Still happening for me…

My requirements.txt:

anyio==3.5.0
APIFlask==0.12.0
apispec==5.1.1
asgiref==3.5.0
attrs==21.4.0
certifi==2021.10.8
click==8.1.2
decorator==5.1.1
dependency-injector==4.39.1
fastapi==0.75.1
FastAPI-SQLAlchemy==0.2.1
Flask==2.1.1
Flask-HTTPAuth==4.5.0
flask-marshmallow==0.14.0
greenlet==1.1.2
h11==0.13.0
idna==3.3
importlib-metadata==4.11.3
iniconfig==1.1.1
itsdangerous==2.1.2
Jinja2==3.1.1
MarkupSafe==2.1.1
marshmallow==3.15.0
packaging==21.3
phonenumbers==8.12.46
pluggy==1.0.0
psycopg2-binary==2.9.3
py==1.11.0
pydantic==1.9.0
pyparsing==3.0.8
pytest==7.1.1
python-decouple==3.6
pytz==2022.1
sentry-sdk==1.5.8
six==1.16.0
sniffio==1.2.0
SQLAlchemy==1.4.35
starlette==0.17.1
tomli==2.0.1
typing_extensions==4.1.1
urllib3==1.26.9
uvicorn==0.17.6
validators==0.18.2
webargs==8.1.0
Werkzeug==2.1.1
zipp==3.8.0

My documentation: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

tiangolo/fastapi - Gitter
This is the error ... I foun the error when i put "str" in "Schema". ... TypeError: cannot create 'cython_function_or_method' instances. Pouchain Rémy....
Read more >
How do I make a class inherit from lxml.objectify.Element?
As the error says: objectify.Element is not a class, it's a cyfunction (a function coded in Cython cython.org), so you cannot inherit from...
Read more >
1792990 – python-fpylll fails to build with Python 3.9: TypeError
Bug 1792990 - python-fpylll fails to build with Python 3.9: TypeError: type() takes 1 or 3 arguments. Summary: python-fpylll fails to build ......
Read more >
TypeError: Shared Cython type cython_function_or_method ...
Solved: TypeError: Shared Cython type cython_function_or_method has the wrong size, try recompiling - Intel Communities.
Read more >
cannot import name 'fastapi' from partially initialized module ...
tiangolo/fastapi[BUG] TypeError: cannot create 'cython_function_or_method' instances#648. Created about 3 years ago. 8. Describe the bug.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found