Category "python-import"

How to programmatically add root folder to the path for every script?

The file structure I currently have is something like: __init__.py script_folder __init__.py s1.py s2.py b_folder __init__.py b1.py b2.p

Python circular imports with inheritance

I have a parent and child class, where a parent's method returns an instance of the child. Both classes are in separate files classA.py and classB.py. In order

Python - Notion API - Can't import module

I'm trying to use Notion API for some automation processes but I am having some trouble importing the packages and I already try a lot of imports. I've this cod

How to set the log level for an imported module?

Write your code with a nice logger import logging def init_logging(): logFormatter = logging.Formatter("[%(asctime)s] %(levelname)s::%(module)s::%(funcNa

Can't import .so file due to permissions missing: failed to map segment from shared object

I'm trying to run a custom project that uses large parts of the SiamMask project. When the code is ran, one of the many imports is this one: from . import regi

How to fix Pylint's false positive Unable to import error?

For last couple of hours I was trying to figure out what's the Pythonic way of importing modules from parent directory and from sub-directories. I made a projec

Dynamic import: How to import * from module name from variable?

As discussed here, we can dynamically import a module using string variable. import importlib importlib.import_module('os.path') My question is how to import

Module not appearing in jupyter

I'm having issues with importing my modules into jupyter. I did the following: Create virtual env Activate it (everything below is in the context of my venv) i

In debug, using pandas before importing from Scipy generates Type error on import

When run in debug in PyCharm 2021.3 (Community Edition) on Mac, the code: import pandas as pd x = pd.DataFrame() from scipy.stats import poisson Generates the

ImportError: DLL load failed: The specified module could not be found - PyCharm

So I've been trying to switch to PyCharm this week and using some of my old code has not been working out. I am using the base anaconda environment as the inter

Force python to use an older version of module (than what I have installed now)

My employer has a dedicated module1 we use for internal unit / system test; however, the author of this module no longer works here and I have been asked to tes

How to specify which pytorch to import, if I have two different versions installed?

The PyTorch previously installed in the remote Linux system is problematic (version 1.8.0). It is in the system folders so I don't have privilege to uninstall o

How to specify which pytorch to import, if I have two different versions installed?

The PyTorch previously installed in the remote Linux system is problematic (version 1.8.0). It is in the system folders so I don't have privilege to uninstall o

How to specify which pytorch to import, if I have two different versions installed?

The PyTorch previously installed in the remote Linux system is problematic (version 1.8.0). It is in the system folders so I don't have privilege to uninstall o