dbeatty10 / dbt-mysql

dbt-mysql contains all of the code enabling dbt to work with MySQL and MariaDB
Apache License 2.0
75 stars 53 forks source link

Preparing metadata (setup.py) error #141

Closed bibimimi103 closed 1 year ago

bibimimi103 commented 1 year ago

Hi,
I was doing python -m pip install dbt-mysql on window powershell and ran into this error

Collecting cffi<1.15,>=1.9 Using cached cffi-1.14.6.tar.gz (475 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [24 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\John\AppData\Local\Temp\pip-install-xb14e42c\cffi_21c026e457b24a1fa2c27f696e5b1d7c\setup.py", line 127, in if sys.platform == 'win32' and uses_msvc(): ^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Temp\pip-install-xb14e42c\cffi_21c026e457b24a1fa2c27f696e5b1d7c\setup.py", line 105, in uses_msvc return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\config.py", line 223, in try_compile self._compile(body, headers, include_dirs, lang) File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\command\config.py", line 128, in _compile self.compiler.compile([src], include_dirs=include_dirs) File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 343, in compile self.initialize() File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\msvc.py", line 210, in msvc14_get_vc_env return _msvc14_get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\msvc.py", line 164, in _msvc14_get_vc_env raise distutils.errors.DistutilsPlatformError( distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

I was wondering if there's a fix for this?

dbeatty10 commented 1 year ago

Thanks for reaching out @bibimimi103 !

I don't have a Windows machine to test this on, so my ability to troubleshoot is limited.

The error message mentioned that

Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

So maybe try downloading the build tools at https://visualstudio.microsoft.com/visual-cpp-build-tools/ ? 🙏

bibimimi103 commented 1 year ago

Thanks for reaching out @bibimimi103 !

I don't have a Windows machine to test this on, so my ability to troubleshoot is limited.

The error message mentioned that

Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

So maybe try downloading the build tools at https://visualstudio.microsoft.com/visual-cpp-build-tools/ ? 🙏

seems like downloading the build tools solved my problem. Apologies for not looking at it closely. However, after it installed and I'm trying to initialize my first project by running command "dbt init first_project" within my clone repository so I could test, I received this error after.

File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\John\AppData\Local\Programs\Python\Python311\Scripts\dbt.exe__main.py", line 4, in File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\dbt\main.py", line 2, in from dbt.logger import GLOBAL_LOGGER as logger, log_cache_events, log_manager File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\dbt\logger.py", line 16, in from dbt.dataclass_schema import dbtClassMixin File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\dbt\dataclass_schema.py", line 13, in from mashumaro import DataClassDictMixin File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro__init.py", line 4, in from mashumaro.serializer.json import DataClassJSONMixin File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\serializer\json.py", line 28, in class DataClassJSONMixin(DataClassDictMixin): File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\serializer\base\dict.py", line 21, in init_subclass raise exc File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\serializer\base\dict.py", line 17, in init_subclass__ builder.add_to_dict() File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\serializer\base\metaprogramming.py", line 365, in add_to_dict pre_serialize = self.get_declared_hook(PRE_SERIALIZE__) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\serializer\base\metaprogramming.py", line 203, in get_declared_hook if type_name(cls) != DataClassDictMixinPath: ^^^^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\meta\helpers.py", line 28, in type_name if is_generic(t): ^^^^^^^^^^^^^ File "C:\Users\John\AppData\Local\Programs\Python\Python311\Lib\site-packages\mashumaro\meta\helpers.py", line 54, in is_generic raise NotImplementedError NotImplementedError

after doing a bit of googling, information that I got is it isn't support by python 3.1.1, I was wondering if this is the case for dbt-mysql?

dbeatty10 commented 1 year ago

No worries @bibimimi103

dbt-mysql doesn't yet support Python 3.10 or 3.11. Issues for each of the are in https://github.com/dbeatty10/dbt-mysql/issues/117 and https://github.com/dbeatty10/dbt-mysql/issues/142

So in the meantime, you'd need to use <= Python 3.9

bibimimi103 commented 1 year ago

thank you for your help! much appreciated.