A strange issue about Python module conflicts [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I am using Anaconda.
After installing the Python package arcade version 2.6.17, I tried to install the latest version of pillow (9.4.0)
I got an error that says:
WARNING: Ignoring invalid distribution -oogletrans (c:\users\user\anaconda3\lib\site-packages)
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
arcade 2.6.17 requires pillow~=9.3.0, but you have pillow 9.4.0 which is incompatible.
I know that this means that the two versions are incompatible, but how can I resolve the issue?

To deal with package conflicts you should use separate environments. They are isolated from one another and can contain different sets and/or versions of packages. It's a good practice to create a separate environment for each project you work on.
# create a new clean environment for the project
conda create -n my_new_shiny_env
# activate the newly created environment
conda activate my_new_shiny_env
# install the arcade package with pip
pip install arcade
pip will manage the arcade's dependencies, while a new clean environment will ensure that there are no other incompatible versions of such dependencies.
If, at the same time, you need a newer version of pillow, that arcade doesn't like, you can create another environment and install it there.

Related

Best way to Install Pip packages(Ubuntu/Linux) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 months ago.
Improve this question
I was wondering since there are so many optinos to install a python package which one is be best and most convenient. should I install packages with sudo and pip3 commands,
E.g
sudo pip3 install <package>
only using pip3
E.g
pip3 install <package>
or using apt
sudo apt install <python-package>
I was wondering which is the go-to and will be most convenient in the future. Mostly wondering what is the difference between Sudo pip3 and pip3 what difference does it make and which one I should use.
Don't use sudo with pip. There is a chance you'll overwrite system-installed packages, and mess up your OS.
sudo apt install <python-package> is pretty safe, but may result in outdated packages, and will definitely not include all packages you may want to install.
pip3 install <package> will install packages for just the current user (thus, not system-wide; if you're the only user, you're fine), and is what I would recommend.
Going further, virtual environment or use of Conda (an "extended" virtual environment manager) are potentially even safer, at the cost of a little more work to set up, and a bit more disk space (usually, the latter is insignificant).
You will have to read up on the use of virtual environment or Conda. That topic is too long for a standard answer here.
I would suggest as first step reading package documentation, as it often contains information regarding how to install it. Few examples regarding popular packages
click suggests pip install click
jinja2 suggests pip install Jinja2
requests suggests python -m pip install requests
Before that check to what version pertains python in your machine (by checking output of python --version), if it is Python 2 and you want to install packages to Python 3, then you need to use pip3 and python3 rather than pip and python, if it is Python 3 you might use command as they are.

How to build and install a Python package locally without uploading to PyPI? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I created a small Python project using a project template. Now I would like to configure the project to be locally installable.
When I run the command:
$ python3.8 -m pip install fdroid_build_checker
I get the following error:
ERROR: Could not find a version that satisfies the requirement fdroid_build_checker (from versions: none)
ERROR: No matching distribution found for fdroid_build_checker
A future step would be to configure the project to be published as a small command line tool.
Your command is searching for the package in PyPi, which won't work because you haven't published the package there.
To install a local package, you should be able to just run pip install path_containing_fdroid_build_checker/froid_buildchecker
You'll have to make sure that your package contains a setup.py file (1) in order for pip to build a wheel and install it successfully.
See https://stackoverflow.com/a/41537134/2741222
1 - https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py

Python can't find any modules, even though they are already installed [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm not sure when this began, but it was recently...
I installed modules via pip on CMD, it all went smoothly until I went to IDE and attempted to import them, each time i get the same error
'ModuleNotFoundError: No module named x'
I have checked that I have Python in my PATH and have reinstalled with different version with no avail.
Try to uninstall everything and even delete the folders where the modules are stored and then try to install it again; this happened to me a while ago and that's how I solved it
Try creating a virtual environment for the current project you are working on using venv https://docs.python.org/3/library/venv.html and use this virtual environment as a test to see if the modules can be used.
It will only look for modules installed within this environment instead of the root installation of python. This may be an easier way to debug your problem and I think it helps to manage different modules imported for different projects to know exactly what versions are being used.
If you are using python 3 ensure you are using the correct version of pip.
sudo apt-get install python3-pip
Then you can install venv using:
sudo pip3 install virtualenv
To create a new virtual environment called "myenv" based on python3 use the command
virtualenv -p python3 myenv
You then need to activate the environment so when installing modules and packages through pip it will install them to this virtual environment only. The command to activate the virtual environment is:
source myenv/bin/activate
Once it is activated the name of the environment you are currently using will appear in brackets on your terminal prompt something like this:
(myenv) [server]:$
Now you can start installing modules using pip3 for this environment
(myenv) [server]:$ pip3 install <module>
Now you should be able to run python scripts using the version of python from this environment with the packages from this environment.
(myenv) [server]:$ python main.py
You could also put the shebang line at the top of the scripts so you dont even need use the command python, it will be evaluated for the default version of python for the current environment. Inside the main.py would look like this:
#!/usr/bin/env python
import <module>
Then to run the script
(myenv) [server]:$ ./main.py
I hope this helps, try it out and let me know if you have any problems.

How to downgrade Python from 3.7 to 3.5 in Anaconda [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I've been trying to downgrade the version of Python in Anaconda as it doesn't support TensorFlow and I get the following error(s):
screenshot of the error
You can create a new environment for your experiments:
conda create -n new_environment python=3.5
Or install anaconda with another python version (http://docs.anaconda.com/anaconda/user-guide/faq/#how-do-i-get-the-latest-anaconda-with-python-3-5)
From your error output it is clear there is a dependency conflict:
backports.os requires python 2.7.
Simply uninstall backports.os like this:
conda uninstall backports.os
And then downgrade Python:
conda install python=3.5
The fact that you're on Python 3.7, but backports.os is still requiring Python 2.7 is proof something has gone wrong with your setup. If you still require backports.os, simply reinstall it when Python is downgraded: conda install backports.os.

ModuleNotFoundError: No module named 'tensorflow' [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
When I'm importing TensorFlow with Spyder as so:
import tensorflow as tf
I then face the following error:
ModuleNotFoundError: No module named 'tensorflow'
How can I overcome this issue?
Since you plan to use tensforflow with Anaconda, you need to install it through Anaconda. It is advisable to do this as follows:
C:> conda create -n tensorflow
C:> activate tensorflow
C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
It is recommended you create a virtual environment as shown above as this makes managing different versions of Python easier. All packages you install (in this case Tensorflow) will become available whenever you activate this virtual environment, and they will not conflict with other versions of Python you may have.

Categories