probably Pylance is having problems with the path for site-packages folder for your virtual environment and returns Import "pytest" could not be resolved, you need to set python path in this way:

"python.pythonPath": "/my/project/path/.venv/bin/python"
Answer from user11717481 on Stack Overflow
🌐
GitHub
github.com › microsoft › pylance-release › issues › 684
'"mock_fixture" is not accessed', and 'Import cannot be resolved' in editor, works fine when running · Issue #684 · microsoft/pylance-release
December 3, 2020 - Pylance can't find the imports and doesn't understand that the fixture is being accessed. I didn't see any errors with trace logging, so I don't think logs will be relevant here. This looks like an issue with Pylance itself. As mentioned above, code for a repro is in https://github.com/macintacos/pylance-pytest-repro
Author   macintacos
Discussions

False "is not accessed".
Environment data Language Server version: v2024.2.2 OS and version: Microsoft Windows [版本 10.0.19045.4046] Python version (& distribution if applicable, e.g. Anaconda): conda, python=3.8.15 req... More on github.com
🌐 github.com
2
March 2, 2024
Recognize pytest fixtures used as arguments that are implicitly accessed
As described in #684, the implicitly used fixture another_fixture in test_main2 is detected as not accessed. The tests show that the fixture is indeed used, since the expected text is printed, but pylance does not know/recognize that. (pylint (2.7.2) throws the unused-argument warning) Since pytest ... More on github.com
🌐 github.com
5
March 17, 2021
'module' is not Accessed Pylance(Pylance is greyed out)
When I am importing the python module 'requests'. PyLance or VSCode underlines it with yellow meaning warning. It is also shown in the problems panel in the integrated terminal of vscode. H... More on github.com
🌐 github.com
51
December 21, 2020
"pyotp" is not accessed Pylance
Hello Friends, I have created virtual environment for my project and install a Module ‘pyotp’, but i am getting import error, ‘pyotp is not accessed Pylance’. please help in this More on discuss.python.org
🌐 discuss.python.org
1
0
October 26, 2024
🌐
freeCodeCamp
forum.freecodecamp.org › python
Pytest Installed, but VS Code Won't Access Pytest - Python - The freeCodeCamp Forum
September 12, 2023 - Hi, I’m starting to learn how to write tests for my code. I’ve installed pytest on my device using pip. But VS Code won’t access it. I assume it’s something to do with the path. I’ve tried using different IDEs, but I…
🌐
GitHub
github.com › microsoft › pylance-release › issues › 5567
False "is not accessed". · Issue #5567 · microsoft/pylance-release
March 2, 2024 - 2024-03-03 02:22:22.640 [info] (23788) [IDX(FG)] read stdlib indices (36ms) 2024-03-03 02:22:22.646 [info] (23788) [IDX(FG)] index libraries (index) [succeed] (43ms) 2024-03-03 02:22:22.650 [info] [Info - 2:22:22 AM] (23788) Background analysis(1) root directory: file:///c:/Users/jingbin/.vscode/extensions/ms-python.vscode-pylance-2024.2.2/dist 2024-03-03 02:22:22.650 [info] [Info - 2:22:22 AM] (23788) Background analysis(1) started 2024-03-03 02:22:22.651 [info] (23788) pytest configurations: {"message":"request cancelled","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["tes
Author   JingBinCN
🌐
GitHub
github.com › microsoft › pylance-release › issues › 1059
Recognize pytest fixtures used as arguments that are implicitly accessed · Issue #1059 · microsoft/pylance-release
March 17, 2021 - (pylint (2.7.2) throws the unused-argument warning) Since pytest obviously works just fine and "accesses" the fixtures in each case, pylance should reflect that by not indicating the fixture as not accessed.
Author   engelfranziska
🌐
GitHub
github.com › microsoft › pylance-release › issues › 757
'module' is not Accessed Pylance(Pylance is greyed out) · Issue #757 · microsoft/pylance-release
December 21, 2020 - When I am importing the python module 'requests'. PyLance or VSCode underlines it with yellow meaning warning. It is also shown in the problems panel in the integrated terminal of vscode. Hope it gets fixed soon. I did not use the Bug Re...
Author   pybash1
🌐
Python.org
discuss.python.org › python help
"pyotp" is not accessed Pylance - Python Help - Discussions on Python.org
October 26, 2024 - Hello Friends, I have created virtual environment for my project and install a Module ‘pyotp’, but i am getting import error, ‘pyotp is not accessed Pylance’. please help in this
🌐
Python Forum
python-forum.io › thread-37255.html
I am trying to run pytest and getting error that doesn't show up when running pytest.
May 19, 2022 - Hi, This is in python flask. I am getting an error in pytest. When I run pytest it says it is working but I get the output below Output:app\tests\functional\test_routes.py . [ 50%] app\tests\unit\test_models.py . [100%]My code is very similar to ...
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › variable is not accessed pylance (visual studio code)
r/learnpython on Reddit: Variable is not accessed pylance (Visual Studio Code)
December 24, 2021 -

So as part of a book I'm working through I'm trying to plot weather data using two different csv files and have implemented a function to do so.

import csv
from matplotlib import pyplot as plt

def get_high(filename, highs):
    with open(filename) as f:
        reader = csv.reader(f)
        header_row = next(reader)

        for row in reader:
            high = int(row[4])
            highs.append(high)

highs = []
get_high('report1.csv', highs)
fig = plt.figure(dpi=128, figsize=(15,9))
plt.plot(highs, c='red')

highs = []
get_high('report2.csv', highs)

plt.plot(highs, c='blue')

plt.title("January Tempatures in Miami 2020(red) vs 1970(blue)", fontsize=20)
plt.xlabel("Days", fontsize=10)
plt.ylabel('Tempatures (F)', fontsize=10)
plt.tick_params(axis='both', major='which', labelsize=16)
plt.show()

When I run this it gives me "high = int(row[4]) IndexError: list index out of range".

I've tried going back and changing 4. At 0 and 1 it tells me "ValueError: invalid literal for int() with base 10:" And as soon as I hit the 2nd index (where the integers start) it gives me the IndexError. I noticed when I hover over header_row it tells me that it can't be accessed and I think that's what's causing this problem but I can't find a fix for it.

EDIT; Also looking for a way to make it so the graph DOESN'T start mapping at 0.

🌐
GitHub
github.com › microsoft › pylance-release › discussions › 5143
"<module_name>" is not accessed Pylance warning when using Conda · microsoft/pylance-release · Discussion #5143
December 1, 2023 - In my case, I have a module transaction_manager.py that contains class TransactionManager. However, even if I've imported the module and instantiate an object of the class in the module, Pylance complains that the module is not accessed and the class is not defined.
Author   microsoft
🌐
GitHub
github.com › microsoft › pylance-release › issues › 1020
Installed packaged not being 'resolved' - Brownie and PyTest · Issue #1020 · microsoft/pylance-release
March 7, 2021 - import brownie from brownie import accounts, Farm import pytest pylance doesn't recognize these libraries though the warning is ignored and compiles correctly as these are all up to date on my ...
Author   liam-ot
🌐
GitHub
github.com › microsoft › pylance-release › issues › 553
Pylance module is not accessed · Issue #553 · microsoft/pylance-release
November 3, 2020 - Pylance module is not accessed#553 · Copy link · Labels · needs investigationCould be an issue - needs investigationCould be an issue - needs investigation · UnknownFX02 · opened · on Nov 3, 2020 · Issue body actions · I am get some issue about pylance: When i from flask_restplus import fields i get "fields is not accessed" My pylance does not suggestions argument of function ·
Author   UnknownFX02
🌐
Visual Studio Code
code.visualstudio.com › docs › python › settings-reference
Python settings reference
November 3, 2021 - Note: If you have never changed your language server setting, your language server is set to Pylance via the “Default” setting value.
🌐
YouTube
youtube.com › programmingknowledge2
How To Fix Import Could Not Be Resolved From Source Pylance - YouTube
Welcome to this tutorial on how to fix "Import could not be resolved from source" Pylance error.Pylance is a powerful language server that provides advanced ...
Published   May 15, 2023
Views   43K
🌐
Stack Overflow
stackoverflow.com › questions › 75839407 › i-is-not-accessed-pylance
visual studio code - i is not Accessed Pylance - Stack Overflow
The for loop line of code shows an error that says i is not Accessed Pylance, which means the Pylance extension is not using the same binary as the project.
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › python
Pylance: can import csv, but NOT sys OR os modules ... WTHey? - Raspberry Pi Forums
Time to go cmd line simple whilst I unravel vscode... Next thing I'd try is to uninstall the python and realated extensions (pylance, etc), close vscode, remove that folder ~/.vscode/extensions/<python ext dirs>, run vscode, reinstall the extensions and see if the issue goes away.