How to get rid of the error "_ms sql" not found - pyinstaller

There is a script with import pymssql.
I'm trying to compile this file with this command
As a result, I get an error:
45873 WARNING: Hidden import "_mssql" not found!
Maybe someone has encountered a similar one? Tell me what can be done?
enter image description here

If you are using pymssql > 2.1.5, you can add these arguments:
--hidden-import decimal --hidden-import pymssql._mssql --hidden-import uuid
when running PyInstaller.
I have updated the hook for this.

Related

anyone know why lintr is marking the first string of my jupyter r kernels in red?

i just set up R to work with Jupyter notebooks in vscode but it is marking the first string of my kernels in red.
The message I get is:
Failed to run diagnostics: ! error in callr subprocess
Caused by error:
! Full file exclusions must be character vectors of length 1. items: 1 are not! lintr
if i uninstall languageserver package then it disappears but vscode asks me to reinstall it and then it comes back
how do i get rid of this?
This is not an answer..
Just information about a similar problem
Could you try to run the R code below:
lintr::use_lintr(type = "tidyverse")
see https://github.com/r-lib/lintr/blob/main/README.md#lintr-file-example for reference.
I think it creates a .lintr file that defines a default behaviour for lintr within your project directory.So you might need to run the code above each time you have a new project

How to troubleshoot Error: Could not find package root?

I am running the command: devtools::use_testthat()
and I get the error:
Error: Could not find package root.
Why this happens?
devtools appears now to require the user to setwd("~/path/to/package"), even if functions like devtools::release() have the pkg= parameter set correctly.
My problem was very similar, but running devtools::document(setwd(...)). The only thing that worked for me:
I copied the DESCRIPTION file from another package (https://github.com/filipezabala/voice);
I ran devtools::document(setwd(...)) again;
After that, I edited the DESCRIPTION file and ran again devtools::document(setwd(...)).

Use Mypy with Ruamel.yaml

I am attempting to use MyPy with modules that use ruamel.yaml and Mypy cannot find ruamel.yaml even though Python has no problem finding it. I am puzzled because I can't find a module called YAML.py or class called YAML either, even though these statements work in Python:
from ruamel.yaml import YAML
yaml = YAML()
x = yaml.load()
What do I need to do to get MyPy to recognize ruamel.yaml?
A workaround is to run without the incremental logic of mypy:
python -m mypy --no-incremental myfile.py
Background
There is a known issue in mypy, see here.
In summary:
Something is not working with the incremental logic of mypy when it is encountering ruamel.
When you run it once, all goes ok. This is the command:
python -m mypy myfile.py
Then, when you run it again, you get an error:
error: Skipping analyzing 'ruamel': found module but no type hints or library stubs [import]
Then, when you run it again, it all goes ok
etc.
You should not be looking for a file YAML.py. The YAML in
yaml = YAML()
is a class that is defined in ruamel/yaml/main.py and that gets imported into ruamel/yaml/__init__.py (both under site-packages). That is why you do:
from ruamel.yaml import YAML
(the alternative would be that there is a file yaml.py under the directory ruamel, but the loader/dumper is a bit too much to put in one file).
What might work if the above knowledge doesn't help you resolve things, is explicitly set the global flag mypy_path or the environment variable MYPYPATH. This has to include the directory in which the directory ruamel is located.
( I could not find it mentioned in the documentation, but from the source ( mypy/build.py:mypy_path() ) you can see that this is supposed to be a string that gets split on os.pathsep (which is the colon (:) on my Linux based system))
I have the same issue.
Even after setting MYPYPATH=./.venv/lib/python3.7/site-packages
A temporary 'solution' is ignoring the missing import exception
mypy --ignore-missing-imports

pyinstaller ImportError: C extension: No module named np_datetime not built

I am running a virtual environment with Python 2.7 for my program.
There seems to be a problem after creating the executable file on windows.
I ran venv/Scripts/pyinstaller.exe -F main.py
everything seems fine. But when i click on the created executable main.exe.
There is an error.
Tried and tested
I have re-installed of pandas and pyinstaller
Implemented the hook-pandas.py to the hooks folder in the environment.
hook-pandas
Ensured the environment is activated.
Checked that the program is running fine before building executable.
Re-created the environment.
Yet after all that, I am prompted with this issue [see Importerror] when I run the executable file.
It is an extreme pain to debug this because the command prompt displaying the error will not pause but close almost immediately.
Similar issues
Looking for Suggestions
I am hoping for suggestions to troubleshoot Pyinstaller. Any resources to read up on would be nice.
Usually, I have no trouble with python as Pycharm has several handy debugging tools that will help me identify the problem
I ran into the same problem and found this thread, but I managed to solve it borrowing from the reference you posted (about pandas._libs.tslibs.timedeltas), so thank you for that!
In that article, the module that resulted in the ImportError was, in fact pandas._libs.tslibs.timedeltas, if you look at the poster's logs. But the error you and I ran into refers to np_datetime instead. So, from the traceback logs, I finally figured out that the code we have to write in hook-pandas.py should be the following:
hiddenimports = ['pandas._libs.tslibs.np_datetime']
Maybe that alone will solve your problem, HOWEVER, in my case, once I solved the np_datetime issue, other very similar ImportError problems arose (also related to hiddenimports regarding pandas), so, in case you run into the same issues, just define hiddenimports as follows:
hiddenimports = ['pandas._libs.tslibs.np_datetime','pandas._libs.tslibs.nattype','pandas._libs.skiplist']
TL;DR:
You can first try to write
hiddenimports = ['pandas._libs.tslibs.np_datetime']
into hook-pandas.py. However, if for some reason you run into the exact same issues I did afterwards, try
hiddenimports = ['pandas._libs.tslibs.np_datetime','pandas._libs.tslibs.nattype','pandas._libs.skiplist']
If you wish to dive deeper (or run into a different pandas ImportError than the ones I did), this is the code in pandas's __init__.py referenced in your traceback log (lines 23 to 35):
from pandas.compat.numpy import *
try:
from pandas._libs import (hashtable as _hashtable,
lib as _lib,
tslib as _tslib)
except ImportError as e: # pragma: no cover
# hack but overkill to use re
module = str(e).replace('cannot import name ', '')
raise ImportError("C extension: {0} not built. If you want to import "
"pandas from the source directory, you may need to run "
"'python setup.py build_ext --inplace --force' to build "
"the C extensions first.".format(module))
From that I went into the
C:\Python27\Lib\site-packages\pandas_libs
and
C:\Python27\Lib\site-packages\pandas_libs\tslibs
folders and found the exact names of the modules that resulted the errors.
I hope that solves your problem as it did mine.
Cheers!

Tracd creating Environment

I was trying to create a Tracd Environment using the following command :
trac-admin D:\My_Project initenv
I get an error saying
Import Error : No module named pkg_resources
What am I missing? I have installed Genshi and Python 2.5.2
Thanks...
Read the Trac wiki. You need setuptools, which you can download here.

Resources