I am trying to use Python as a scripting language and use Numpy arrays in my module package. I get this message that a file in Numpy is missing. Does the embedded package have anything that would help me?
On what OS? With which version of Python? Installed from where? (You mentioned
python39.lib in the title so I’m going to guess Windows, but your post is still lacking a lot of fairly basic details. As smart as the people here are, they are not psychics and cannot magically divine information about your situation.)
“This message”? What message? When asking for help with any software in any forum, always provide exact transcripts of both what you tried to do, and then what happened as a result.
For example, here’s how I set up an environment with NumPy enabled, on my Linux system (which obviously has no bearing on your Windows situation, but just to illustrate the point…)
$ cd /tmp/ $ python3 -m venv numpy-test $ cd numpy-test $ . ./bin/activate $ python3 -m pip install setuptools wheel Requirement already satisfied: setuptools in ./lib/python3.9/site-packages (53.0.0) Collecting wheel Using cached wheel-0.37.0-py2.py3-none-any.whl (35 kB) Installing collected packages: wheel Successfully installed wheel-0.37.0 WARNING: You are using pip version 21.0.1; however, version 21.2.4 is available. You should consider upgrading via the '/tmp/numpy-test/bin/python3 -m pip install --upgrade pip' command. $ python3 -m pip install numpy Collecting numpy Downloading numpy-1.21.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.8 MB) |████████████████████████████████| 15.8 MB 11.5 MB/s Installing collected packages: numpy Successfully installed numpy-1.21.2 WARNING: You are using pip version 21.0.1; however, version 21.2.4 is available. You should consider upgrading via the '/tmp/numpy-test/bin/python3 -m pip install --upgrade pip' command.
If something had gone wrong, other users would have all of the information they need to help me sort out the problem. Don’t make other people have to guess how to help you.
You mean this thing? No, based on what I assume you’re trying to do (because it isn’t really clear), that would be exactly the opposite of what you need. Embedding Python is necessary when using it from compiled programs written in C/C++; if you’re using it as a scripting language then you have no need for that. Building NumPy to run as a Python extension (which is the most likely reason you’d need
python39.lib) is a completely separate thing.
It sounds as if you’re already using NumPy, at least in your development environment. — If not, then you should just be following the Python and NumPy Installation Guide which takes you through all of the steps required for a working install. You shouldn’t need to build NumPy yourself, I wouldn’t think.
So assuming that’s not the issue, I’m not sure exactly when you’d be hitting problems compiling an extension. Perhaps when trying to move your code to a new system? If so, first installing NumPy in the recommended fashion, before trying to install your own code, is still the best advice. Especially on Windows where a C++ compiler isn’t even part of the standard install, and may very well not be available.
The reason those files would be necessary, when they’re normally not needed to just run Python scripts, is because NumPy is (or, includes) a Python extension module: It’s partly written in C/C++ code, which is then compiled (using
python39.lib) into a loadable Python extension. When someone wants to build NumPy for themselves, they need a C++ compiler and those files. But most people don’t need to do that, other people have already taken care of it and we can just download the results. So, it’s still likely the case that you’d be better off avoiding the need for
python39.lib, than actually locating them. It should be possible to do what you need to do without compiling any extensions, unless you’re writing an extension. (But you didn’t mention that.)
If you really do want to compile an extension yourself, though, it’s possible that you’ve installed the Python runtime, but not the development components. The files you mentioned aren’t necessary to merely run
.py code in the Python interpreter. It could be that they’re installed separately.
(The equivalent files on Fedora Linux are part of the “
python3-devel” package, which is separate from the
python3 package that installs the
pip3 commands. It’s possible to install
python3-devel, and would create the same problem.)
It could also be the case that the development files are present on the system, but NumPy simply doesn’t know where to find them. (#BecauseWindows)
Regardless, please provide a lot more information, including exact details of your system environment and what you’ve tried so far, and we can try to get you back on the right track.