Using virtualenv with python3 in openSuSE - python-3.x

I am experiencing a problem when using virtualenv in openSuSE 12.3 with Python3:
I installed the python3 and python3-devel packages.
Then I installed the newest distribute and pip and finally virtualenv using pip.
When I try to create a virtualenv I get the following error:
$ virtualenv-3.3 venv01
Using base prefix '/usr'
New python executable in venv01/bin/python3.3
Also creating executable in venv01/bin/python
Installing distribute.........................................................................................................................................................................................................................................................................................................................................................................................................done.
Installing pip....
Complete output from command /home/user/venv01/bin/python3.3 -x /home/user/venv01/bin/easy_install /usr/local/lib/pytho...ort/pip-1.3.1.tar.gz:
/home/user/venv01/bin/python3.3: can't open file '/home/user/venv01/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv-3.3", line 9, in <module>
load_entry_point('virtualenv==1.9.1', 'console_scripts', 'virtualenv-3.3')()
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 1094, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 667, in install_pip
filter_stdout=_filter_setup)
File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 1057, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/user/venv01/bin/python3.3 -x /home/user/venv01/bin/easy_install /usr/local/lib/pytho...ort/pip-1.3.1.tar.gz failed with error code 2
Running it with -vvv yields some interesting output that shows that distribute
is extracted to <venv>/local/lib/python3.3/site-packages/.
I wonder why distribute is not installed into <venv>/lib/python3.3/site-packages/?
Does anyone have an idea why this happens and how I can use virtualenv in
openSuSE without compiling python3 myself?

[now fixed in latest patches from opensuse]
[oh! i just realised you are the same person as the original link. sorry. but i will leave this as it is a top result for google search on this issue (was searching myself for any update) so it may help others.]
this is a known issue, discussed at https://forums.opensuse.org/english/get-technical-help-here/applications/484475-using-virtualenv-python-3-a.html and with an open bug at https://bugzilla.novell.com/show_bug.cgi?id=809831
the only work-around i know of is to install everything yourself. it's not so hard, and i describe what is necessary at http://www.acooke.org/cute/GettingPyt0.html
basically:
install python 3.3 from source (do an "altinstall" to install as /usr/local/bin/python3.3)
fix the lib issue (link lib_dynload from /usr/local/lib64/python3.3 to /usr/local/lib/python3.3)
install distutils
install virtualenv
then you can use python3.3 and virtual-env-3.3 etc as expected.

Related

Pip can't find module pip._internal.utils

I did a fresh install of Python 3.8.3 for Windows 10. I can't get pip to work, it keeps complaining about module pip._internal.utils that can't be found.
When I run pip -v as a regular user, this is what I get:
Traceback (most recent call last):
File "c:\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python38\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\verhager\AppData\Roaming\Python\Python38\site-packages\pip\__init__.py", line 1, in <module>
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
File "C:\Users\verhager\AppData\Roaming\Python\Python38\site-packages\pip\_internal\__init__.py", line 1, in <module>
import pip._internal.utils.inject_securetransport # noqa
ModuleNotFoundError: No module named 'pip._internal.utils'
I have tried reinstalling, rebooting, running as Administrator, reinstalling pip with get_pip.py, but nothing has worked sofar.
When searching, I found several people having similar issues on different OSes. It seems like I've tried all suggested solutions, but nothing has worked for me sofar.
Reinstalling didn't solve my problem. That is, not before I really made sure that nothing was left behind.
My Python install was in C:\Python38\. After uninstalling python, this directory remained and contained some left over modules, like pip. I manually deleted the whole C:\Python38 folder.
Then, I checked my AppData folder in my home dir. Everything in this folder and all subfolders that was related to Python or Python modules, I deleted as well. Keep in mind AppData is a hidden folder, so it you might have to enable showing of hidden files and folders in the explorer first.
Finally, I removed all Python folders from my PATH environment variables (system as well as user).
After that, I did a new install of Python 3.8 and everything works as expected.
What I think the problem was? Some left overs from a previously (broken) installation messed with my environment, causing pip not resolving required modules.
I had the same error as you, with Windows 10. I also investigated and found that the "pip._internal.utils" package was missing. I was able to overcome this issue without an extensive Cleanup/Reinstall of Python.
After ensuring the following
That the Python Binary and Scripts folders were part of %PATH%
That I was on a Console Window with Administrator privileges
I ran the following command
python -m ensurepip --default-pip
With this command the package was installed. I did a general verification of the installation with the following command.
pip --version
Which returned the with specs. This command invokes the missing package.
I faced the same issue and here's how I resolved this error on windows 7 -
Navigate to C:\Users<user-name>\AppData\Roaming\Python\Python38\site-packages
Delete pip folder
This is introduced when I read this messsage
"You should consider upgrading via the 'python -m pip install --upgrade pip' comand." and followed using the same command for upgrading.

I tried pip installing spyder terminal in windows and now spyder 4.1.3 won't open

I have used matlab, but I am only 2 weeks into Python. I downloaded anaconda 3.7 and am using spyder 4.1.3. I was following a youtube tutorial on python. I was doing well until the guy access the cmd prompt (I use Windows 10) from within his IDE.
I didn't know how to so I googled it and to do so I found on pypi.org that all I had to do was run pip install spyder-terminal in the cmd prompt. I tried this but at the end it said that I had a permissions error and to try the --user option. I copied and pasted the exact error and saw on git hub, to create an environment or run python -m pip install --user [INSERT PACKAGE NAME].
I don't really understand hat an environment is so I did the second --user way. I ran python -m pip install --user spyder terminal I got an error about a location not being in the path variable, so i just copied the file location that it referenced and copied it the the path. I then went to open up spyder 4.1.3 and i got the error
Traceback (most recent call last):
File "C:\Users\Aaron\anaconda3\lib\site-packages\qtpy\__init__.py", line 204, in
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Aaron\anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\Aaron\anaconda3\lib\site-packages\spyder\app\start.py", line 201, in main
from spyder.app import mainwindow
File "C:\Users\Aaron\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 53, in
requirements.check_qt()
File "C:\Users\Aaron\anaconda3\lib\site-packages\spyder\requirements.py", line 41, in check_qt
import qtpy
File "C:\Users\Aaron\anaconda3\lib\site-packages\qtpy\__init__.py", line 210, in
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found"
I tried opening it again and got the same error. I then tried uninstalling an dre-installing spyder in the anaconda navigator and got the same error. I tried removing the location I added to path and running "pip uninstall spyder-terminal", it said it was removed and I go the same error.
If possible, I am seeking specific steps in layman's terms, because all my knowledge thus far has come from the first 2 hours of a "cool things in python" type video.

I Tried to Install PyQtWebEngine, Always Stuck on the Same Problem. Couldn't Fine the solution anywhere [duplicate]

This question already has an answer here:
Why python executable opens new window instance when function by multiprocessing module is called on windows
(1 answer)
Closed 3 years ago.
I'm new to this. Sorry for the mess.
I've been trying to install PyQtWebEngin, first On zorin os which is dualboot along with Windows10, it failed. Then I decided to install it on Linux Mint on VM inside Windows10. The error result is alway the same.
Here take a look,
poo#poo:~/Downloads$ pip3 install PyQtWebEngine
Collecting PyQtWebEngine
Using cached https://files.pythonhosted.org/packages/71/be/cd5243a456aae37788eebd8333d2326fd830de7ce1f1ac6618e966a66862/PyQtWebEngine-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting PyQt5-sip<13,>=12.7 (from PyQtWebEngine)
Using cached https://files.pythonhosted.org/packages/69/d2/92d85b0865fe68755488a30eec1c2b1b14da6c96c74441dc1c88e0659397/PyQt5_sip-12.7.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting PyQt5>=5.14 (from PyQtWebEngine)
Using cached https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-3tqr21z4/PyQt5/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-3tqr21z4/PyQt5/
Can you guys help me out.
Thanks in advance.
Your pip seems to be trying to use a source distribution of PyQt5 for installation, but it seems that setup.py is missing from the .tar.gz on pypi, which is odd.
According to the docs installing from source is not recommended anyway
However using pip to install from the source package is not recommended
I do not know why your pip chose to download the .tar.gz in the first place. Looking at the other whl files from you log with cp36-cp36m-manylinux1_x86_64.whl, there is a PyQt5-5.14.1-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl on pypi that should be compatible with your system and should be the first choice of pip for downloading.
You can try to do it manually:
wget https://files.pythonhosted.org/packages/ea/9d/d609aab4111d9d74857fb73067f7de4ca38fc1f7fff87ceba092681754cf/PyQt5-5.14.1-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl
pip install PyQt5-5.14.1-5.14.0-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl
And then try your installation again

Xcode 9.1 export fails with "The /usr/bin/xattr tool may be damaged"

Xcode 9.0.1 crash when export ipa or upload to App Store in MacOS 10.13.1.
After upgraded to Xcode 9.1 (9B55), it shows error as below when export.
Stripping extended attributes failed.
"/usr/bin/xattr -crs /var/folders/mm/h01jykrs7gv9w7jjb0yt609w0000gp/T/XcodeDistPipeline.Uay/Root/Payload/GitSmartHome.app" exited with a non-zero status. The /usr/bin/xattr tool may be damaged.
It seems xattr was damaged, and when run xattr in Terminal, it prompts below error.
xattr
Traceback (most recent call last):
File "/usr/bin/xattr-2.7", line 7, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 3019, in <module>
File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 3003, in _call_aside
File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 655, in _build_master
File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 963, in require
File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 849, in resolve
pkg_resources.DistributionNotFound: The 'xattr==0.6.4' distribution was not found and is required by the application
How to fix it or re-install xattr?
Xcode always looks at /usr/bin/xattr, regardless of your paths (as you might have a working xattr installed elsewhere).
Typing in /usr/bin/xattr gave this output:
/usr/bin/xattr
Traceback (most recent call last):
File "/usr/bin/xattr-2.7", line 7, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.12-intel/egg/pkg_resources/__init__.py", line 72, in <module>
File "build/bdist.macosx-10.12-intel/egg/packaging/requirements.py", line 59, in <module>
TypeError: __call__() takes exactly 2 arguments (1 given)
You need to get your system's python happy again. I seem to have broken mine at some point. Not sure how.
I ran the following and got a screen full of errors.
/usr/bin/python -m pip install -U setuptools
Afterwards, I ran /usr/bin/xattr again it it was silent. This seems to be the test for whether it's healthy.
My XCode exports now without the error.
The crux is that your /usr/bin/xattr will give you some kind of error, whether it's permissions or some other python/setup issue. You need to fix that to have your builds working again.
Edit:
For those with permission issues, run this:
sudo chown -R $USER:$(id -g) /Users/$USER/Library/Python
I had this problem too. It turned out that this started happening after I zapped /Library/Python/2.7 and with it I deleted /Library/Python/2.7/site-packages/Extras.pth. Here's what was in it:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
The first of these directories contains an old version of xattr that still supports -c option (something I could not resolve by installing xattr v0.6.4 myself).
➜ /usr/bin/xattr
python version 2.7.14 can't run /usr/bin/xattr. Try the alternative(s):
/usr/bin/xattr-2.6 (uses python 2.6)
/usr/bin/xattr-2.7 (uses python 2.7)
Run "man python" for more information about multiple version support in
Mac OS X.
➜ cd /usr/bin
➜ sudo rm xattr
➜ sudo ln -s xattr-2.7 xattr
➜ /usr/bin/xattr
#Ren gave a good hint, following his thought, with the help of Ned Deli's Answer, solved the problem here.
My situation: python 2.7 as default system version(use pyenv normally). /usr/bin/xattr always tempts to call /usr/bin/xattr-2.7, which won't be successful. Calling xattr-2.6 works fine, forcing /usr/bin/xattr call xattr-2.6 leads to "option -c not recognized" while the XCode trying to call xattr -crs ....
Solution: After using command: $defaults write com.apple.versioner.python Version 2.6 Xcode can finally distribute my app.
You can set your system default python whenever you like back to 2.7 with:
$unset VERSIONER_PYTHON_VERSION
If your mac throws you an error like "option -c not recognized" you can still try to launch the original source code "xattr python tool" using a command like this:
sudo python /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/xattr/tool.pyc -cr /Applications/[Application].app
It works for me ;)
I just ran into the same issue and resolved it with:
/usr/bin/python -m pip install xattr==0.6.4
reinstall xcode-select, open terminal and type
xcode-select --install

python-escpos windows giving "bugtrack_url" error

Trying to install python-escpos library. The instructions say the following:
Ensure the library is installed on ${lib_arch}/${python_ver}/site-packages/escpos
On CLi you must run:
python setup.py build
sudo python setup.py install
What does ${lib_arch}/${python_ver}/ mean? Is it the path such as
\Users\RickT\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\escpos?
When I run python setup.py build, I get the following error:
C:\Users\RickT\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg)Traceback (most recent call last):
File "setup.py", line 140, in <module> 'python-escpos = escpos.cli:main'
As I wrote in the comments you should write which version of the documentation you are using and which version of the codebase you are using.
The "error" considering the bugtrack_url is just a warning because setuptools does not know this token. This should not affect your setup in any way. You probably installed it successfully.
Concerning your question about the path: ${lib_arch}/${python_ver}/site-packages/escpos is more or less non-sense in a Windows-context. This just means your location of the site-packages-directory. So, your assumption is right.
All in all the probably easiest solution for you would be installing with pip. This would simply be - considering you have a working pip - a one-liner:
pip install python-escpos

Resources