python 'pip' has no attribute 'main' - attributes

I have been looking all over for a solution. I found one question asking something similar to this, but they were doing it inside of python(which I also tried) and the answers didn't work. So please don't be mad; nothing seems to work!
I've been having a lot of troubles with pip. I am on windows 10, python 3.6. First it wouldn't let me install scipy no matter what I did, so I uninstalled it and reinstalled. get-pip.py wouldn't work, so I reinstalled python and had it put pip in my path. Now no matter what I try I get:
ImportError: module 'pip' has no attribute 'main'
Pip is in my path, just like it used to be. I was going to uninstall it again, but because it has no 'main' pip uninstall pip also says it does not have 'main'. I've tried to fix the path, reinstall pip, reinstall python, use easy_install instead, and I am stuck. I have no idea how to uninstall pip at this point. Sorry if this is basic!
I am so lost. I would really appreciate some help! This is a great community! Thanks!! Let me know if you need more information

Check the Scripts directory in your virtual environment home directory. Is there a pip.exe in Scripts? It can be in the path but not installed in the environment itself. You can just copy one from another env Scripts, but make sure it's the right version of pip. DRY

Related

Spyder, clean Win installation, ver. 4.2.3 - pip gives message "No module named pip"

I have Spyder, clean Win10 installation, ver. 4.2.3.
When I run command pip, it gives message:
Note: you may need to restart the kernel to use updated packages.
C:\Users\UserName\AppData\Local\Programs\Spyder\Python\python.exe: No module named pip
I restarted Spyder, Win10, nothing helps.
How to fix it?
Thanks.
(Spyder maintainer here) We don't provide pip in our Windows app to prevent people breaking Spyder by installing any kind of packages with it.
The best way to use other packages that don't come with our app is to install Miniconda, create a conda environment after that with the packages you want to use and spyder-kernels, and finally connect Spyder to that env.
If you have python 3.4+ then pip should be installed with python.
To check that, you can run
pip help
in your windows command line.
However, if it isn't the case then download the get-pip.py file and run
python get-pip.py
and the pip installation should start. You can use pip help to verify this.
Another source of the problem might be that pip isn't listed in your PATH variables and thus isn't recognized by your command line.

PyMesh Installation on Python 3.6 Windows

I am trying to install Pymesh on Python 3.6.
In my first try, I installed through pip, however it installed a wrong PyMesh than I wanted.
It installed the following, https://pypi.org/project/pymesh/, while I wanted https://pymesh.readthedocs.io/en/latest/
I uninstalled it, and tried installing the later PyMesh, however no luck. There were no instructions for windows. I downloaded the source from github. I extracted and pasted it in C:\Python36\Lib\site-packages
Then I ran python3 setup.py build - when an error showed up, I also tried python3 setup.py install, which worked. However, I am unable to do a simple basic command mentioned in the web page: https://pymesh.readthedocs.io/en/latest/basic.html
It is saying pymesh does not have module name load_mesh.
Looking for the process or thoughts on how to properly install pyMesh for Windows.
My go to solution for problems like this on Windows is always to try it in a conda env first. If that fails, use Docker.

Add package to Conda Environment from site-packages

this might be a fundamental misunderstanding of Python packages, but I could use some help or directions to the right resources.
I have a egg file in my Python 3.6 site-packages directory, i'll call it package.egg. When I run python from the command line I can use modules from that package. However, when I created a new Pycharm Project and a corresponding Conda environment, I can no longer use that package (for obvious reasons). However, it doesn't seem like just copying package.egg file into the project environments site files.
Is there another process, like unzipping that I have to perform before I can call those modules?
I tried running both pip install ./package.egg and conda install ./package.egg
Thank you.
I was able to resolve this error by reinstalling the package in the context of the new environment. In this case, through the PyCharm terminal I went back to the packages setup.py file and ran that. It installed the package into the correct location in my conda environment.

Symbol lookup error in /usr/bin/python3 "_Py_CoerceLegacyLocale" in new Fedora 27

Thanks for your patience, this question has not been answered anywhere on the internet and I am unable to find any clues on how to fix it.
The problem is:
[jv#xp ~]$ /usr/bin/python3
/usr/bin/python3: symbol lookup error: /usr/bin/python3: undefined symbol: _Py_CoerceLegacyLocale
Before this happened I was fixing problems with anaconda3 python environments so there may be a connection there.
It is the new Fedora 27 system python3 that all the packaging systems(yum, dnf) depends on, so if I am unable to fix it, it is probably better to re-install the whole system.(Which will probably mean that with a face of defeat, looking down I ll go back to mint :-/ )
Here this gentleman is battling the same problem:
https://forums.fedoraforum.org/showthread.php?316109-f26-DNF-error-undefined-symbol-_Py_CoerceLegacyLocale
Thanks for your help. Any clues and advice will be greatly appreciated.
I had the same problem after installing python3 via conda.
What I did to solve this problem was to :
1/
Reinstall python3, python3-libs and system-python with the following command :
python2 /usr/bin/yum reinstall python3-libs
(note that you can still run dnf and yum with python2, assuming that only python3 was broken)
2/
Remove the following files :
/usr/lib/libpython3.so
/usr/lib/libpython3.6m.so
/usr/lib/libpython3.6m.so.1.0
The command rpm -qf libpython3.6m.so says that those files do not belong to any package. They were surely installed via conda.
The problem was that the python3 executable loaded these shared libraries instead of the good ones.
While conda update intel-openmp didn't work for me;
conda install --channel conda-forge llvm-openmp worked for me.

Pip Uninstall and Install same package gives 'AssertionError: Multiple .dist-info directories'

I am having trouble installing and installing again the same package. I get an 'AssertionError: Multiple .dist-info directories' error. I think that it has something to do with the pip uninstall not completely getting rid of all the files of a package, but am not sure how to remedy the situation. I don't know what information would be helpful here, except maybe that this is a Django project, running on virtualenv on IIS.
EDIT: I just re-installed python and with it, a new version of pip.
Remove the related pip build directory for that particular package and try installing it again. That'd work.
If you're working in a virtual environment say venv, pip build directory will be <path-to-venv>/venv/build/<package-name>.

Resources