Giter VIP home page Giter VIP logo

Comments (6)

cdiener avatar cdiener commented on May 31, 2024 1

Seems reasonable to me. Feel free to send a PR with a newer requirement. That way we will see if the CI passes.

from cobrapy.

Midnighter avatar Midnighter commented on May 31, 2024 1

Maybe just >=1.6 would allow both users of <2 and >2 to happily use cobrapy.

from cobrapy.

teddygroves avatar teddygroves commented on May 31, 2024 1

The PR above just changes the ~ here to a > as @Midnighter suggests.

I think the CI is just waiting for a maintainer to approve before it sets off.

from cobrapy.

cdiener avatar cdiener commented on May 31, 2024

Now fixed in 0.27.0.

from cobrapy.

chrismgowen avatar chrismgowen commented on May 31, 2024

Problem description

From a quick look I don't think cobrapy uses pydantic except for in this file, which I think is compatible with pydantic version 2 as is. It therefore doesn't seem like a very hard bug to fix: just remove the pin or change it to a version greater than 2.

@teddygroves or @cdiener, did you test whether the file referenced is compatible with pydantic v2? I ask because when setting up a new environment with conda, I get the following import error when importing cobra (cobra=0.29.0, pydantic=2.5.6):

Traceback (most recent call last):
File "", line 1, in
File "/home/a/.conda/envs/cobra/lib/python3.12/site-packages/cobra/init.py", line 17, in
from cobra import io
File "/home/a/.conda/envs/cobra/lib/python3.12/site-packages/cobra/io/init.py", line 9, in
from cobra.io.web import AbstractModelRepository, BiGGModels, BioModels, load_model
File "/home/a/.conda/envs/cobra/lib/python3.12/site-packages/cobra/io/web/init.py", line 6, in
from .biomodels_repository import BioModels
File "/home/a/.conda/envs/cobra/lib/python3.12/site-packages/cobra/io/web/biomodels_repository.py", line 14, in
class BioModelsFile(pydantic.BaseModel):
^^^^^^^^^^^^^^^^^^
File "/home/a/.conda/envs/cobra/lib/python3.12/site-packages/pydantic/init.py", line 372, in getattr
module = import_module(module_name, package=package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/a/.conda/envs/cobra/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/a/.conda/envs/cobra/lib/python3.12/site-packages/pydantic/main.py", line 13, in
from pydantic_core import PydanticUndefined
ImportError: cannot import name 'PydanticUndefined' from 'pydantic_core' (unknown location)

I forced conda to install pydantic-1.10.0 and import cobra works fine. I do not have experience with pydantic, so I'm not clear if this is an issue with the requirements or not, but it appears that something does break when upgrading to pydantic v2.

from cobrapy.

cdiener avatar cdiener commented on May 31, 2024

Hi this error seems to be raised in pydantic itself and there seems to have been a bug in the conda package. Can you update your pedantic in the environment to a newer build and try again?

from cobrapy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.