You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pyo3 fails to compile in a fresh project using the exact readme example code for Using python from rust on multiple systems (Windows, Linux, macOS) with: error[E0119]: conflicting implementations of trait python::IntoPyDictPointer for type (_, _)
The full error message, code as well as steps are below.
🌍 Environment
I tried on three systems: Windows 10 Pro, WSL Ubuntu, OSX 10.11.6 and Linux Mint 19
Your python version: probably irrelevant, because compilation failed. I use both Python2.7 and 3.6
How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: probably irrelevant
Your rust version (rustc --version): rustc 1.30.0-nightly (f2302daef 2018-09-12)
💥 Reproducing
New Project cargo new pyotest && cd pyotest
Add pyo3 = "0.3" to dependencies in Cargo.toml¹ as shown in README.md
Copy the example code from the README.md² to src/main.rs
Install nightly with rustup install nightly
Set toolchain to nightly echo "nightly" >> rust-toolchain
Check version with rustc --version
Execute cargo run
See my output of cargo run
Compiling version_check v0.1.4
Compiling proc-macro2 v0.4.19
Compiling libc v0.2.43
Compiling unicode-xid v0.1.0
Compiling ucd-util v0.1.1
Compiling regex v1.0.5
Compiling cfg-if v0.1.5
Compiling proc-macro-hack-impl v0.4.1
Compiling utf8-ranges v1.0.1
Compiling num-traits v0.2.5
Compiling spin v0.4.9
Compiling log v0.4.5
Compiling regex-syntax v0.6.2
Compiling lazy_static v1.1.0
Compiling memchr v2.0.2
Compiling proc-macro-hack v0.4.1
Compiling aho-corasick v0.6.8
Compiling quote v0.6.8
Compiling mashup-impl v0.1.7
Compiling thread_local v0.3.6
Compiling syn v0.14.9
Compiling mashup v0.1.7
Compiling pyo3-derive-backend v0.3.2
Compiling pyo3 v0.3.2
Compiling pyo3cls v0.3.2
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `(_, _)`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:246:1
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
245 |
246 | impl<K: ToPyObject, V: ToPyObject> IntoPyDictPointer for (K, V) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)`
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `(_, _)` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `()`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/noargs.rs:66:1
|
66 | impl IntoPyDictPointer for () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
::: /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:231:1
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `()` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _),)`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _),)`
...
264 | dict_conversion!(1, (ref0, 0, A1, A2));
| --------------------------------------- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _),)` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _))`
...
265 | dict_conversion!(2, (ref0, 0, A1, A2), (ref1, 1, B1, B2));
| ---------------------------------------------------------- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _))`
...
266 | dict_conversion!(3, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2));
| ----------------------------------------------------------------------------- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _), (_, _))`
...
267 | / dict_conversion!(4, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2),
268 | | (ref3, 3, D1, D2));
| |____________________________________- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _), (_, _), (_, _))`
...
269 | / dict_conversion!(5, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2),
270 | | (ref3, 3, D1, D2), (ref4, 4, E1, E2));
| |_______________________________________________________- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _), (_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`
...
271 | / dict_conversion!(6, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2),
272 | | (ref3, 3, D1, D2), (ref4, 4, E1, E2), (ref5, 5, F1, F2));
| |__________________________________________________________________________- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`
...
273 | / dict_conversion!(7, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2),
274 | | (ref3, 3, D1, D2), (ref4, 4, E1, E2), (ref5, 5, F1, F2), (ref6, 6, G1, G2));
| |_____________________________________________________________________________________________- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`
...
275 | / dict_conversion!(8, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2),
276 | | (ref3, 3, D1, D2), (ref4, 4, E1, E2), (ref5, 5, F1, F2), (ref6, 6, G1, G2),
277 | | (ref7, 7, H1, H2));
| |____________________________________- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))` in future versions
error[E0119]: conflicting implementations of trait `python::IntoPyDictPointer` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`:
--> /home/d0/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.3.2/src/objects/dict.rs:255:5
|
231 | / impl <K, V, I> IntoPyDictPointer for I
232 | | where
233 | | K: ToPyObject,
234 | | V: ToPyObject,
... |
243 | | }
244 | | }
| |_- first implementation here
...
255 | impl<$($T1: ToPyObject, $T2: ToPyObject),+> IntoPyDictPointer for ($(($T1,$T2),)+) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))`
...
278 | / dict_conversion!(9, (ref0, 0, A1, A2), (ref1, 1, B1, B2), (ref2, 2, C1, C2),
279 | | (ref3, 3, D1, D2), (ref4, 4, E1, E2), (ref5, 5, F1, F2), (ref6, 6, G1, G2),
280 | | (ref7, 7, H1, H2), (ref8, 8, I1, I2));
| |_______________________________________________________- in this macro invocation
|
= note: upstream crates may add new impl of trait `std::iter::Iterator` for type `((_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _), (_, _))` in future versions
error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0119`.
error: Could not compile `pyo3`.
To learn more, run the command again with --verbose.
¹ My Cargo.toml:
[package]
name = "pyotest"
version = "0.1.0"
authors = ["atoav <[email protected]>"]
[dependencies]
pyo3 = "0.3"
² A exact copy of the code I used:
#![feature(specialization)]
extern crate pyo3;
use pyo3::prelude::*;
fn main() -> PyResult<()> {
let gil = Python::acquire_gil();
let py = gil.python();
let sys = py.import("sys")?;
let version: String = sys.get("version")?.extract()?;
let locals = PyDict::new(py);
locals.set_item("os", py.import("os")?)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract()?;
println!("Hello {}, I'm Python {}", user, version);
Ok(())
}
The text was updated successfully, but these errors were encountered:
🐛 Bug Reports
Pyo3 fails to compile in a fresh project using the exact readme example code for Using python from rust on multiple systems (Windows, Linux, macOS) with:
error[E0119]: conflicting implementations of trait
python::IntoPyDictPointer
for type(_, _)
The full error message, code as well as steps are below.
🌍 Environment
rustc --version
): rustc 1.30.0-nightly (f2302daef 2018-09-12)💥 Reproducing
cargo new pyotest && cd pyotest
pyo3 = "0.3"
to dependencies in Cargo.toml¹ as shown in README.mdrustup install nightly
echo "nightly" >> rust-toolchain
rustc --version
cargo run
See my output of
cargo run
¹ My Cargo.toml:
² A exact copy of the code I used:
The text was updated successfully, but these errors were encountered: