How do I handle Import Errors?

Emma

I got this error when trying to run a python file with:

from sklearn.model_selection import train_test_split

The error is:

ImportError: cannot import name 'ThreadPool' from 'multiprocessing.pool' (/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py)

However, when I execute the same line from the terminal as:

>>> from sklearn.model_selection import train_test_split

it works without any error.

Any idea what might cause this error? and how to fix it?

Joshua Varghese

Mostly, these errors are caused by naming of other and current scripts with the names of library files. So renaming these helps you handle the error.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I handle errors in a deferred function?

How do I handle errors with promises?

How do I handle JavaScript Fetch errors?

How do I handle RapidXml errors?

How do I handle transaction errors?

How Do I Handle Errors Globally in TestCafe

How do I handle stripe errors for "redirectToCheckout"?

How do i handle errors in Dio package

How do I handle errors in passport.deserializeUser()?

How do I handle errors in a worker pool using WaitGroup?

How do I handle errors in mapped functions in AWS Glue?

How do I handle errors that are already handled by another error?

How do I handle errors when responseType is blob using Vuejs?

In React, how do I handle errors coming back from the server?

How do i handle errors correctly and prevent showing folder directory

How do I handle errors in an f-string?

How do I handle different errors when working with an API?

How do I handle errors from cleanup / destroy functions

How do I fix PyDev "Undefined variable from import" errors?

How do calculators handle floating point errors?

How can I handle errors in picocli?

How can I handle _popen() errors in C?

How should i handle dism powershell errors?

How can I handle input errors in HotChocolate?

How do I handle network errors so they don't appear in chrome developer console?

How do I handle errors without checked exceptions in a services orchestration scenario?

How do I capture the exit code / handle errors correctly when using process substitution?

(Discord PY) How do I handle slash command errors from different cog files?

How do I handle errors for fs.createReadStream() in Node.js?