Open henriquemac-cyber opened 1 year ago
The best way to use this library is to include it into your pyproject.toml file. This is what pip is now using as a default. Here is an example of what you want to do in the pyproject.toml file
[build-system]
requires=[
"setuptools>=67.8.0",
"wheel>=0.40.0",
"pyMSVC>=0.5.3;sys_platform=='win32'"
]
build-backend="setuptools.build_meta"
This will only install the module for the building only and only when Windows is the OS being used.
then in your setup.py file at the top you have this code.
import sys
if sys.platform.startswith('win'):
import pyMSVC
env = pyMSVC.setup_environment()
print(enc) # provides a nice output that shows what has been found. this is optional.
I do want to note that in order to run the setup.py file directly without PIP you are going to need to have pyMSVC installed into your site-packages folder. There are other ways to get it to work without having to do that but since the packaging system in Python has changed the functions in setuptools that existed have been removed recently. so now there is no way to force the install of pyMSVC from inside of the setup.py file easily. You can have it download from the repository as a zipfile and extract the contents so it can be run but there is no simple one line way of doing it anymore.
This library supports the entire range of Visual C, Visual C++, Visual C Build Tools, Visual Studio and Visual Studio Build tools lineup. It doesn't rely on calling vswhere from a subprocess which would require knowledge of the installation path of Visual Studio which is kind of self defeating because that is what is being looked for. This is what SetupTools does and it is the reason why it fails. No static paths are coded into pyMSVC for anything. not even the Program Files or Program Files x86 folders. All the information is gotten by using COM interfaces and the Windows API. No assumptions are made as to the locations of things.
Another recent change that was made to pip/setuptools caused a problem with doing a local import from the setup.py file and that could also be the error you are seeing. I would need to see the exaact error to be able to help you further.
If you are installing a library made by someone and you are getting an error that MSVC is not able to be located then you need to open an issue in that libraries repository and you can point them here as the solution to the problem.
Hey! Wonderful job here! Thank you.
I finally can run my Cython code. I run in my conda env terminal: "pip install pyMSVC"; put the stuff (in end of README) in the Cython setup.py and all magic was done. I confess that took some time to realize that was those kind of setup.py you were talking about. My suggestion is detail it better for the ogres understanding.
Now I know it may be possible resolve another kind of problems. The MSVC compile issues for "pip install [pkg]", where pip doesnt find the MSVC. I'm getting some pain, to install re2, and python-snappy packages.
I was for the setup.py of pip error message inside the python virtual environment, but I had found nothing beyound another setup,py inside other package. I tried for re2, but no files there. Maybe they were deleted after bad installation error. Or I could not find the right place yet.
Could you realize?