Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PythonCall.js Not finding MicrosoftChannel Conda modules as named. Cherry pick? but how? #389

Closed
hubert-associates opened this issue Oct 21, 2023 · 2 comments
Labels
question Further information is requested

Comments

@hubert-associates
Copy link

hubert-associates commented Oct 21, 2023

Microsoft now has explicit support for Conda. Hurray, I thought :-) Here are the salient links on that:
https://devblogs.microsoft.com/azure-sdk/python-conda-sdk-preview/
https://anaconda.org/Microsoft/azure-cosmos
https://anaconda.org/conda-forge/azure-cosmos
https://azure.github.io/azure-sdk/releases/latest/index.html#python

Here is my attempt as newcomer to PythonCall to get a simple ac=pyimport("azure-cosmos") to work with these Microsoft-channel modules. As shown below, pyimport("azure") works, but then does not provide the cosmos symbols I need (ac.CreateDatabase etc...)

Any idea what I'm doing wrong? ... as I continue to weed through various trial-error options... Thanks for any tips.

(@v1.9) pkg> conda add azure-cosmos
    CondaPkg Found dependencies: /home/hubert/.julia/environments/v1.9/CondaPkg.toml
    CondaPkg Found dependencies: /home/hubert/.julia/packages/PythonCall/qTEA1/CondaPkg.toml
    CondaPkg Resolving changes
             + azure-cosmos
    CondaPkg Installing packages
             │ /home/hubert/.julia/artifacts/87052ac9aec71548f804b30280151288cb1ed40e/bin/micromamba
             │ -r /home/hubert/.julia/scratchspaces/0b3b1443-0f03-428d-bdfb-f27f9c1191ea/root
             │ install
             │ -y
             │ -p /home/hubert/.julia/environments/v1.9/.CondaPkg/env
             │ --override-channels
             │ --no-channel-priority
             │ azure-cosmos[version='*']
             │ azure-storage[version='*']
             │ libstdcxx-ng[version='>=3.4,<13.0',channel='conda-forge']
             │ numpy[version='*']
             │ python[version='>=3.7,<4',channel='conda-forge',build='*cpython*']
             │ urllib3[version='*']
             │ -c Microsoft
             └ -c conda-forge
conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache
Microsoft/linux-64                                            No change
Microsoft/noarch                                              No change

Transaction

  Prefix: /home/hubert/.julia/environments/v1.9/.CondaPkg/env

  Updating specs:

   - azure-cosmos=*
   - azure-storage=*
   - conda-forge::libstdcxx-ng[version='>=3.4,<13.0']
   - numpy=*
   - conda-forge::python[version='>=3.7,<4',build=*cpython*]
   - urllib3=*


  Package            Version  Build               Channel           Size
──────────────────────────────────────────────────────────────────────────
  Install:
──────────────────────────────────────────────────────────────────────────

  + azure-cosmos  2023.09.01  py_0                Microsoft        113kB

  Reinstall:
──────────────────────────────────────────────────────────────────────────

  o libstdcxx-ng      12.3.0  h0f45ef3_2          conda-forge     Cached
  o python            3.12.0  hab00c5b_0_cpython  conda-forge     Cached

  Upgrade:
──────────────────────────────────────────────────────────────────────────

  - azure-core        1.29.5  pyhd8ed1ab_0        conda-forge     Cached
  + azure-core    2023.09.01  py_0                Microsoft        113kB

  Summary:

  Install: 1 packages
  Reinstall: 2 packages
  Upgrade: 1 packages

  Total download: 226kB

──────────────────────────────────────────────────────────────────────────



Transaction starting
azure-core                                         113.0kB @  60.2kB/s  1.9s
azure-cosmos                                       113.1kB @  56.2kB/s  2.0s
Reinstalling libstdcxx-ng-12.3.0-h0f45ef3_2
Reinstalling python-3.12.0-hab00c5b_0_cpython
Changing azure-core-1.29.5-pyhd8ed1ab_0 ==> azure-core-2023.09.01-py_0
Linking azure-cosmos-2023.09.01-py_0

Transaction finished

To activate this environment, use:

    micromamba activate /home/hubert/.julia/environments/v1.9/.CondaPkg/env

Or to execute a single command in this environment, use:

    micromamba run -p /home/hubert/.julia/environments/v1.9/.CondaPkg/env mycommand


(@v1.9) pkg> conda st
CondaPkg Status /home/hubert/.julia/environments/v1.9/CondaPkg.toml
Environment
  /home/hubert/.julia/environments/v1.9/.CondaPkg/env
Packages
  azure-cosmos v2023.09.01
  azure-storage v2021.03.15b1
  numpy v1.26.0
  urllib3 v2.0.7
Channels
  Microsoft
  Microsoft

julia> np=pyimport("numpy")
Python: <module 'numpy' from '/home/hubert/.julia/environments/v1.9/.CondaPkg/env/lib/python3.12/site-packages/numpy/__init__.py'>

julia> ac=pyimport("azure-cosmos")
ERROR: Python: ModuleNotFoundError: No module named 'azure-cosmos'
Python stacktrace: none
Stacktrace:
 [1] pythrow()
   @ PythonCall ~/.julia/packages/PythonCall/qTEA1/src/err.jl:94
 [2] errcheck
   @ ~/.julia/packages/PythonCall/qTEA1/src/err.jl:10 [inlined]
 [3] pyimport(m::String)
   @ PythonCall ~/.julia/packages/PythonCall/qTEA1/src/concrete/import.jl:11
 [4] top-level scope
   @ REPL[10]:1

julia> ac=pyimport("azure")
Python: <module 'azure' (namespace) from ['/home/hubert/.julia/environments/v1.9/.CondaPkg/env/lib/python3.12/site-packages/azure']>

@hubert-associates hubert-associates added the question Further information is requested label Oct 21, 2023
@hubert-associates
Copy link
Author

Persistence may be paying off: although it is written "azure-cosmos" everywhere, "azure.cosmos" seems to get me further... Maybe far enough, not sure yet:

julia> ac=pyimport("azure.cosmos")
Python: <module 'azure.cosmos' from '/home/hubert/.julia/environments/v1.9/.CondaPkg/env/lib/python3.12/site-packages/azure/cosmos/init.py'>

@cjdoris
Copy link
Collaborator

cjdoris commented Oct 22, 2023

Cool, sounds like you solved your problem.

@cjdoris cjdoris closed this as completed Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants