microsoft / microsoft/vscode-python-tools-extension-template
Numpy error when using bundled libs from different python version
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 184
- Forks
- 51
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 1
Description
Hello team,
thanks for this template!
I am building an extension using this template, see the repo.
And it works, but only if the python version is the same as the python version used when it was built.
If it is not the case, when the user's python (python 3.12) has not the same version as the one that built it (python 3.11). I get the following error from numpy:
File "/home/inigo/.vscode-server/extensions/codecarbon.codecarbon-0.1.0/bundled/libs/codecarbon/core/cpu.py", line 13, in <module>
import pandas as pd
File "/home/inigo/.vscode-server/extensions/codecarbon.codecarbon-0.1.0/bundled/libs/pandas/__init__.py", line 19, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
What do you think I should do? Build an extension per python version and then detect which one to load?
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the bundled dependency paths shown in the traceback, especially bundled/libs/codecarbon/core/cpu.py and bundled/libs/pandas, and reproduce the import using a Python 3.12 runtime with dependencies built under Python 3.11. Determine the supported version strategy and verify that dependencies import correctly for each supported Python version, or that incompatible versions are clearly rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100