question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"sqrt" is not a known member of module (numpy)

See original GitHub issue

When running the command-line pyright on

import numpy

numpy.sqrt(5.0)

I correctly get

No configuration file found.
stubPath /tmp/typings is not a valid directory.
Assuming Python platform Linux
Searching for source files
Found 1 source file
0 errors, 0 warnings, 0 infos
Completed in 0.635sec

When using coc-pyright, I get

[Pyright (reportGeneralTypeIssues)] [E] "sqrt" is not a known member of module

A bug?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nschloecommented, Dec 1, 2020

Indeed, this is fixed in numpy master and will be part of the next release. https://numpy.org/devdocs/release/1.20.0-notes.html#numpy-is-now-typed

1reaction
yaegassycommented, Dec 1, 2020

@nschloe

If you want to get similar error results, try to run pyright --lib. (If you don’t have stub installed)

... snip
  3:7 - error: "sqrt" is not a known member of module (reportGeneralTypeIssues)
1 error, 0 warnings, 0 infos
... snip

Until numpy 1.20 is released, it’s best to use a third-party stub. (e.g. data-science-types) REF: https://github.com/numpy/numpy/issues/17826#issuecomment-731862373

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - global name 'sqrt' not defined - Stack Overflow
I've created a function, potential(x,K,B,N) , where x , K , B are numpy arrays and N is an integer. I'm trying to...
Read more >
numpy.sqrt — NumPy v1.24 Manual
Return the non-negative square-root of an array, element-wise. Parameters: xarray_like ... If not provided or None, a freshly-allocated array is returned.
Read more >
NameError: name 'sqrt' is not defined in Python | bobbyhadz
The Python "NameError: name 'sqrt' is not defined" occurs when we use the sqrt function without importing it first. To solve the error...
Read more >
Numpy square root explained - Sharp Sight
This tutorial will show you how to use the NumPy square root function (AKA, np.sqrt). It will explain the syntax, and show you...
Read more >
I do not know what im doing, help? - Codecademy
In this module, He asks us to find the square root using a function built into python called sqrt() However, If you run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found