How to install YAML package in Pycharm (Python 3.8 / 3.9)? - pip

How do I install the YAML package in Pycharm? I want to use it for a python 3.8 (or 3.9) project. When trying to install the package via the project settings I get the following error:
ERROR: Could not find a version that satisfies the requirement yaml
Alternatively I tried to search for any YAML package available via the command window by typing pip search yaml. Then I get the following error:
ERROR: XMLRPC request failed [code: -32500]
Any advice?
Thanks

pip install pyyaml
I think that this is what you are looking for: https://pypi.org/project/PyYAML/
It gets imported as import yaml

Related

How do I specify a minimum package version in pipit setup.cfg

I am trying to specify a minimum package version in a pypi setup.cfg file. I have written this:
install_requires =
cocotb>=1.5.2
But I get this error message when I test my package installation:
ERROR: Could not find a version that satisfies the requirement cocotb>=1.5.2 (from pyuvm) (from versions: 1.0.20170128)
ERROR: No matching distribution found for cocotb>=1.5.2
It seems to be using the version number as part of the package name. When I install cocotb manually I see the correct version:
(clean) (base) raysalemi#RayProMac pyuvm % pip list
Package Version
---------- -------
cocotb 1.5.2
All the help I've seen on this refers to the setup.py file, but I am working with the setup.cfg file. What is the syntax to specify a module and version?
The syntax is correct. The problem was that cocotb 1.5.2 is not on test.pypi.org

ERROR: Could not find a version that satisfies the requirement unittest (from versions: none) ERROR: No matching distribution found for unittest

Recently I have been installed Python 3.8.2 ( Feb 24, 2020) (64bit, Windows). Afterward, I've been updated Pip 20.0.2. And then trying to install Unittest" pip install unittest" but unfortunately it's appearing this message.
Does anyone has been faced this same problem?
C:\Users\BiploB>pip install unittest --user
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
ERROR: Could not find a version that satisfies the requirement unittest (from versions: none)
ERROR: No matching distribution found for unittest
enter link description here
If I am not mistaken unittest is part of Python's standard library. Meaning, it's available per default, meaning there is no need (and also no way) to install separately.

protoc with grpc_python_plugin: google/protobuf/any.proto: File not found

I'm running this command:
protoc protobuf/file.proto --proto_path=protobuf --proto_path=protobuf --python_out=out/builtin_pb --grpc_out=out/builtin_pb --plugin=protoc-gen-grpc=/usr/local/bin/grpc_python_plugin
where file.proto has:
syntax = "proto3";
import "google/protobuf/any.proto";
And stuff like:
google.protobuf.Any arg = 3;
However, it has the error:
google/protobuf/any.proto: File not found.
bess_msg.proto: Import "google/protobuf/any.proto" was not found or had errors.
bess_msg.proto:251:3: "google.protobuf.Any" is not defined
...
Are there any steps I can follow to make sure any.proto is properly installed?
Thanks
I had this error when trying to compile a protobuf to python on Ubuntu. My problem was that I had installed the compiler using sudo apt install protobuf-compiler, but I had not installed the resources using sudo apt install libprotobuf-dev.
Thanks to this answer for showing me the error of my ways.
I recently encountered this issue and realized that I was using protobuf 3.0. Simply upgrade the protobuf compiler to the latest version (3.6 in my case) for definitions on those types.

Import NLTK : no module NLTK corpus

I have installed NLTK. Here's an image of the installation log.
When i use import nltk i get an error:
"No module named NLTK.corpus"
Here is a screenshot.
What could be the cause?
I think I had the same problem. So, downloading all the packages at once (since question didn't specify).
Start python and then import the packages, exit python and upgrade nltk. Modify the 'all' to download a specific corpus. Took me awhile to complete the 'all' download, I separately downloaded framenet_v15 and restarted the 'all' after. Upgrade nltk when the download is complete.
$ python
>>>import nltk
>>>nltk.download('all')
exit python
$ pip install --upgrade nltk
To fix this, you should rename your file to something else, say nltkXXX.py. Also make sure to remove "nltk.pyc" from your directory if it exists, since this will also be loaded (it's the byte compiled version of your code). After that, it should work fine.
If you are using the latest version of python, then try installing nltk using pip and the wheel downloaded from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Then in command prompt, use the command:
pip3 install
This should install nltk correctly.
After that check the installation in python using the command:
import nltk
and download the nltk data required using:
nltk.download()
If you find (Import NLTK : no module NLTK corpus) that type of error .
Make sure your saved file not be the name like (nltk.py).
so just rename your file name (like rename nltk.py to example.py ) or something else:
I hope it will help you.
thanks
If you has using PyCharm IDE, you should have install NLTK from the IDE's own tools [File -> Settings -> Projetct Interpreter -> Install (button '+') -> Install Package].

easy_install M2Crypto failing on Windows platform

I am attempting to install M2Crypto on a Windows XP platform. I have Python, easy_install and SWIG installed, but when I attempt to easy_install M2Crypto I get the following:
SWIG\_m2crypto.i(31) : Error: Unable to find 'openssl\opensslv.h'
SWIG\_m2crypto.i(45) : Error: Unable to find 'openssl\safestack.h'
SWIG\_evp.i(12) : Error: Unable to find 'openssl\opensslconf.h'
SWIG\_ec.i(7) : Error: Unable to find 'openssl\opensslconf.h'
error: Setup script exited with error: command 'swig.exe' failed with exit status 1
I have read elsewhere that people have suggested easy_install openssl-devel, but that simply tells me that there are no packages found with that name. Is the name perhaps case-sensitive (I've tried various permutations without success), or does that advice not apply to Windows?
I'm not looking for alternatives to M2Crypto. I am picking up some existing code that uses it, so I need to get my development environment to be able to run what's already written.
As jay stated in his answer you should try to build it from source. And I tried. The setup.py does not recognize the --openssl option. Looking at the output from the default setup.py I realized that the search location was c:\pkg and not c:\pkg\openssl.
The solution:
Download and install OpenSSL from Win32 OpenSSL
Copy the lib and include folders to c:\pkg
Check that swig.exe is available in your path
Run easy_install M2Crypto
Worked for me like a charm.
Had a similar problem. After downloading the source package of M2Crypto and reading the INSTALL file I found the following:
Differences when installing on Windows
--------------------------------------
Before building from source, you need to install OpenSSL's include files,
import libraries and DLLs. By default setup.py assumes that OpenSSL include
files are in ``c:\pkg\openssl\include``, and the import libraries
in ``c:\pkg\openssl\lib``. As with other platforms, you can specify a different
OpenSSL location with --openssl option to build_ext command.

Resources