Common Python Errors and Environment Fixes

The command python setup.py egg_info failed with error code 1 error means pip cannot build a package’s metadata, almost always because setuptools is outdated. Fix it by running pip install --upgrade pip setuptools wheel before retrying. If that fails, your virtual environment is broken or pointing at the wrong Python interpreter.

  • Key Takeaway 1: Most ModuleNotFoundError failures come from installing a package into the wrong Python environment, not a missing package itself.
  • Key Takeaway 2: The egg_info error is almost always a setuptools or pip version problem, fixed in one upgrade command.
  • Key Takeaway 3: TypeError: 'int' object is not subscriptable means you are treating a number like a list or dictionary. Check your variable types first.
  • Key Takeaway 4: Deleting a conda environment is a single terminal command and takes under 10 seconds.
  • Key Takeaway 5: ValueError: invalid literal for int() fires when you pass a non-numeric string to int(). Validate input before converting.

How to Fix command python setup.py egg_info failed with error code 1

When pip throws command python setup.py egg_info failed with error code 1, it is running a legacy build step and failing because your build tools are outdated. Follow these steps in order:

  1. Run pip install --upgrade pip setuptools wheel
  2. Retry your original install command
  3. If it still fails, check whether the package supports your Python version on PyPI
  4. As a last resort, create a fresh virtual environment with python -m venv env and install there

According to the Python Packaging Authority (PyPA), the egg_info command is part of the legacy distutils build system, deprecated since Python 3.10. Many older packages have not migrated to pyproject.toml, which is why the command python setup.py egg_info failed with error code 1 error still appears in 2025 for packages like mysqlclient, lxml and Pillow on Windows. Indian developers working on data science projects at companies in Bengaluru and Hyderabad frequently encounter this error when setting up legacy ML pipelines.

Fixing ModuleNotFoundError and Common Runtime Errors

ModuleNotFoundError: No Module Named ‘requests’ or ‘bs4’

A ModuleNotFoundError: No module named requests usually means the package is installed in a different Python environment than the one your script is running in. This is especially common in VS Code, where the selected Python interpreter can silently mismatch your active virtualenv.

Run which python (macOS/Linux) or where python (Windows) to confirm which interpreter is active. Then run pip show requests to confirm where the package is installed. If the paths do not match, that is your problem.

The same fix applies for ModuleNotFoundError: No module named bs4. The PyPI package name is beautifulsoup4, so the install command is pip install beautifulsoup4. According to the Stack Overflow Developer Survey 2023, Python is the most popular language among developers in India, with over 48% of Indian respondents using it regularly, making environment mismatches one of the most commonly searched Python errors on Indian developer forums including GeeksforGeeks and NPTEL discussion boards.

TypeError: ‘int’ Object Is Not Subscriptable

This error fires when you write x = 5 and then try x[0]. Python is telling you that integers do not support indexing. You can only use square brackets on sequences like strings, lists and tuples.

Use print(type(x)) to inspect the variable at runtime. If you are working with API responses or function return values, the function may be returning an integer in an error case instead of the list you expected.

ValueError: Invalid Literal for int() with Base 10

This happens when you write int("hello") or int("12.5"). Python’s int() function only accepts strings that look exactly like whole numbers. A decimal string like "12.5" needs float() first: int(float("12.5")).

For user input validation, wrap the conversion in a try/except ValueError block. According to the JetBrains Python Developer Survey 2023, ValueError and TypeError together account for roughly 38% of the runtime errors developers encounter during development. Building a habit of input validation early saves significant debugging time, a point consistently emphasised in Python courses on Indian platforms like GUVI and Coding Ninjas.

If you are building these skills to land a job, check out our guide on entry-level tech jobs for teens and fresh graduates to see which roles actually require Python proficiency.

Fixing the command ‘python.execInTerminal-icon’ Not Found Error

This error appears in VS Code when the editor cannot find a valid Python interpreter. Open the Command Palette with Ctrl+Shift+P, type “Python: Select Interpreter”, and choose the correct environment. If no interpreters appear, install the Python extension and restart VS Code.

Conda Environment Management: Anaconda Prompt Cheat Sheet

Conda environments keep your Python projects isolated. If you are working in data science or machine learning, you should be using them. Here is the practical reference most tutorials skip.

Essential Anaconda Prompt Commands

Task Command Notes
Create a new environment conda create -n myenv python=3.11 Specify Python version explicitly
Activate an environment conda activate myenv Run before installing packages
Deactivate current environment conda deactivate Returns to base
List all environments conda env list Active env marked with *
Install a package conda install numpy Use pip install if not on conda-forge
Delete a conda environment conda remove -n myenv --all Irreversible, confirm the name first
Export environment to file conda env export > environment.yml Use for sharing or backup
Recreate from file conda env create -f environment.yml Useful for team projects

How to Delete a Conda Environment Safely

To delete a conda environment, first run conda deactivate, then run conda remove -n myenv --all, replacing myenv with your environment’s actual name. Verify the name first using conda env list.

According to Anaconda’s 2023 State of Data Science report, over 60% of data practitioners in the Asia-Pacific region use conda as their primary environment manager. In India specifically, conda is the default environment tool taught in data science programmes at institutions including IITs and NITs, as well as on NPTEL’s Python for Data Science course, which has over 200,000 registered learners.

Python skills like these are increasingly listed as prerequisites for high-paying roles. Our breakdown of top online courses for high-salary jobs covers which certifications pair well with Python to boost your employability in 2025 and 2026.

If you are still figuring out which direction to take your career, the guide on how to choose the right career path after graduation is worth reading before you commit to a specialisation.

Python sits at the foundation of cybersecurity scripting, AI development and data engineering, all covered in the best career options in 2026 for students and professionals, which maps skills to actual job titles and salaries.

Students who want a well-rounded technical foundation should also look at the top skills every college student must learn before graduation. Python consistently appears alongside Linux, Git and basic networking.

If budget is a concern, our list of best free online learning platforms for students covers where you can practice Python without spending anything, including platforms popular with Indian students like SWAYAM and freeCodeCamp.

Next Steps You Can Take This Week

Start by auditing your Python setup. Run python --version and pip --version in your terminal right now. If pip is below version 23, upgrade it. If you are using the system Python instead of a virtual environment, create one today.

Practice the conda commands in the table above in a test environment. Create one, install a couple of packages, export it to a YAML file, delete the environment, and recreate it from the file. That single exercise covers 80% of what you will need day-to-day.

If you want to go deeper into programming, automation and cybersecurity, explore the full course catalogue at 3.0 University where you will find practical, industry-aligned programmes in Ethical Hacking, AI, Blockchain and Web3, built around skills employers actually test for in interviews.

Frequently Asked Questions

How do you fix the command python setup.py egg_info failed with error code 1?

The command python setup.py egg_info failed with error code 1 is caused by outdated build tools. Run pip install --upgrade pip setuptools wheel to fix it in most cases. If the package is very old and unmaintained, it may not support your current Python version at all and you will need a newer alternative or a compatible Python version in a separate virtual environment.

How do you fix ModuleNotFoundError in Python?

First confirm which Python interpreter is active using which python or where python. Then run pip show package-name to check if the module is installed in that environment. If it is not, run pip install package-name inside the correct virtual environment. In VS Code, use “Python: Select Interpreter” to make sure the editor and your terminal match.

How do you fix ‘int object is not subscriptable’?

This TypeError fires when you use square bracket indexing on an integer variable. Check the variable’s type with print(type(variable)) before accessing it. The fix is either to change the logic that assigns the value, or to ensure the function or API you are calling is actually returning a list or string rather than a plain integer.

How do you delete a conda environment?

Run conda deactivate to exit the environment first, then run conda remove -n environment-name --all. Confirm the exact name beforehand using conda env list. The --all flag removes all packages and the environment directory. This action is permanent, so double-check the name before hitting Enter.

What causes ValueError: invalid literal for int()?

Python’s int() function only converts strings that represent whole numbers. Passing "12.5", "abc" or an empty string raises this ValueError. Use int(float(value)) for decimal strings, or wrap the conversion in a try/except ValueError block when handling user input to catch bad values before they crash your programme.

Why does pip install fail on Windows?

On Windows, pip install failures are often caused by missing C++ build tools required by packages like lxml or mysqlclient. Install the Microsoft C++ Build Tools from the Visual Studio installer, then retry. The command python setup.py egg_info failed with error code 1 error is especially common on Windows for this reason. Upgrading pip and setuptools first with pip install --upgrade pip setuptools wheel resolves the majority of cases.

How do I fix Python interpreter path issues in VS Code?

Open the Command Palette with Ctrl+Shift+P and select “Python: Select Interpreter”. Choose the interpreter that matches your active virtual environment. If the correct environment does not appear, make sure you have activated it in the terminal first and that the Python extension is installed. Reloading the VS Code window after switching interpreters resolves most path mismatch issues.

Last updated: June 2025. Reviewed by the 3University editorial team.

We create, review, and maintain educational content covering Cybersecurity, Ethical Hacking, Artificial Intelligence, Blockchain, Web3, and emerging technologies.

Read More Articles